home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 August: Tool Chest / Dev.CD Aug 98 TC.toast / Tool Chest / Testing & Debugging / Mac OS Development Toolkit / Automation Essentials 2.3.0 / • Other Stuff / Scripting Aids / App Functional Scripting / Adobe Photoshop PPC 3.0.1.vu next >
Encoding:
Text File  |  1998-03-19  |  77.9 KB  |  2,314 lines  |  [TEXT/MPS ]

  1. #
  2. # ****************************************************************************
  3. #
  4. #    File Name:    Adobe Photoshop PPC 3.0.1.vu
  5. #
  6. #    Contains:    Quick look test script for Photoshop version PPC 3.0.1
  7. #
  8. #    Written by:    Mitch Forcnrook
  9. #
  10. #    Copyright:    © 1993 by Apple Computer, Inc., all rights reserved.
  11. #
  12. # ****************************************************************************
  13. #            C h a n g e        H i s t o r y (most recent first):
  14. # ****************************************************************************
  15. #
  16. #    Vers      Date        Author              Description
  17. #    ----    --------    ------              ---------------------------------------------
  18. #    2.0        03/07/96    MDF                  Added functional script parts and
  19. #                                          beefed up QL tests.
  20. #    1.3     02/15/96    G O'Sullivan      Upgraded to use b-trait
  21. #    1.2.2    02/14/96    Mary Lehane          Updated so that it would dismiss the floating
  22. #                                          window during the setting up of the globals    
  23. #    1.2.1    12/13/95    M. Forncrook      Fixed name in resource for gAppTitle.
  24. #    1.2        09/01/95    G O'Sullivan      Made script localizable.
  25. #    1.1         08/23/95    G O'Sullivan/MDF  Added Printer Testing.  Modified
  26. #                                          the HandleDialogs() task.
  27. #    1.0        01/04/95      M. Forncrook        Updated from version 2.5.1 to version 3.0.1 for PowerPC.
  28. #
  29. # ****************************************************************************
  30. #
  31.  
  32. ########################################################################
  33. #                            External libraries 
  34. #=======================================================================
  35. Libraries "Output.Lib","DoTasks.Lib","Draw.Lib","UserInterface.Lib","DA.Lib",
  36.           "Geometry.Lib","Font.Lib","Globals.Lib","LaunchQuit.Lib","TCS.Lib",
  37.           "TargetCheck.Lib","ExceptionHandling.Lib","WorldReady.lib",
  38.           "String.Lib","StandardFile.Lib","Clouseau.Lib","TestLevel.Lib";
  39.  
  40.  
  41. #########################################################################
  42. ########               Application Specific Tasks
  43. #########################################################################
  44.  
  45. #########################################################################
  46. #                        InitAppGlobals()
  47. #========================================================================
  48. # Author:        ML
  49. # Description:    Sets up tools for Photoshop.  This task
  50. #                must be called first.
  51. # Parameters:    None
  52. # Returns:        Nothing
  53. # Examples:        InitAppGlobals()
  54. #========================================================================
  55. # History:
  56. #    08/23/95    GOS        Added gDoCloseAppHook2
  57. #
  58. ########################################################################
  59. task InitAppGlobals()
  60. begin
  61.     logstr("Setting up {global gApptitle}'s globals");            
  62.     
  63.         ### For Intl support
  64.     global gScriptResourceBase;
  65.     
  66.         ### Region Insets
  67.     global gWindowInset := {10,10,25,25};
  68.     global gScreenInset := {62,25,10,10};
  69.     
  70.         ### Custom Opening 'New' dialog for DoSetupApp()
  71.     global gCustomNewDocDialog := [window t:'New' o:1];
  72.     
  73.         ### Overide default window desc used in OpenFile()
  74.     global gCustomRetrievedDoc := [window t:/≈RGB≈/];     # partial name of the saved document
  75.  
  76.         ### Tool Types
  77.     global kClick, kDrag, kDragClick, kMultiDrag, kMultiClickDrag, kMultiClick;
  78.     
  79.         ### Palette Types
  80.     global kPalDocWind, kPalWind, kPullOffPal, kPopUpPal, kScrollPal;
  81.     
  82.         ### Palette Numbers
  83.     global kToolPaletteNum := 1;
  84.     global kScreenModeToolPaletteNum := 2;
  85.     global kLinePaletteNum := 3;
  86.     global kColorPaletteNum := 4;    # actually defined in SetPhotoshopColor()
  87.     global kBackgroundColorPaletteNum := 4;    # same as the color palette, defined in SetPhotoshopBackgroundColor()
  88.     
  89.         ### Palette Structures
  90.     global gPaletteList :=
  91.         {
  92.             {                                                #### Start Palette #1 - Main Tools
  93.             {GetIndString(gScriptResourceBase+4,12),2,1},    # Specifier, Top margin, Left margin
  94.             kPalWind,                                        # Palette type
  95.             {2,10},                                            # Size of Tool matrix {numElemsWide,numElemsTall}
  96.             {26,21}                                            # Offset between tools {h,v}
  97.             },                                                #### End Palette #1 - Main Tools
  98.             {                                                #### Start Palette #2 - Screen Mode Tools
  99.             {GetIndString(gScriptResourceBase+4,12),296,4},    # Specifier, Top margin, left margin
  100.             kPalWind,                                        # Palette type
  101.             {3,2},                                            # Size {numElemsWide,numElemsTall}, bug in SPEC with 1xn palettes
  102.             {15,15}                                            # Offset between tools {h,v}
  103.             },                                                #### End Palette #2 - Screen Mode Tools
  104.             {                                                #### Start Palette #3 - Brushes
  105.             {GetIndString(gScriptResourceBase+4,15),16,0},    # Specifier, Top margin, left margin
  106.             kPalWind,                                        # Palette type
  107.             {6,2},                                            # Size {numElemsWide,numElemsTall}
  108.             {32,32}                                            # Offset between tools {h,v}
  109.             }                                                #### End Palette #3 - Brushes
  110.         };
  111.  
  112.  
  113.     ### PhotoShop                                                                        {flag,pat,lnWght,Col,grad,bgCol,TxtCol,penPat}
  114.     ### Palette Elements:=        Tool#, Pal#, ToolName,         ToolType,    DblClktoEnd        SetAttributes
  115.     global MarqueeTool         :=     { 1,     1,     "Marquee",         kDrag,             0,             {0}                    };
  116.     global LassoTool        :=     { 2,     1,     "Lasso",         kMultiDrag,     0,             {0}                    };
  117.     global MagicWandTool    :=     { 3,      1,     "MagicWand",     kClick,        0,             {0}                    };
  118.     global MoveTool            :=    { 4,    1,     "Move",         kDrag,            0,            {0}                    };
  119.     global HandTool             :=     { 5,      1,     "Hand",         kMultiDrag,    0,             {0}                    };
  120.     global ZoomTool         :=     { 6,      1,     "Zoom",         kClick,         0,             {0}                    };
  121.     global CropTool             :=     { 7,     1,     "Crop",         kDrag,            1,             {0}                    };
  122.     global TypeTool             :=     { 8,     1,      "Type",         kClick,        0,             {1,0,0,0,0,0,0,0}    };
  123.     global PaintBucketTool     :=     { 9,     1,      "PaintBucket",     kClick,        0,             {1,0,0,1,0,0,0,0}    };
  124.     global GradientFillTool    :=     { 10,     1,     "GradientFill", kDrag,         0,             {1,0,0,1,0,1,0,0}    };
  125.     global LineTool            :=     { 11,     1,     "Line",         kDrag,            0,             {1,0,0,1,0,0,0,0}    };
  126.     global EyeDropperTool    :=     { 12,     1,     "EyeDropper",     kMultiClick,    0,             {0}                    };
  127.     global EraserTool        :=     { 13,     1,      "Eraser",         kMultiDrag,    0,             {1,0,0,0,0,1,0,0}    };
  128.     global PencilTool         :=     { 14,     1,      "Pencil",         kMultiDrag,    0,             {1,0,1,1,0,0,0,0}    };
  129.     global AirbrushTool         :=     { 15,     1,      "Airbrush",     kMultiDrag,    0,             {1,0,1,1,0,0,0,0}    };
  130.     global PaintBrushTool    :=     { 16,     1,      "PaintBrush",     kMultiDrag,    0,             {1,0,1,1,0,0,0,0}    };
  131.     global RubberStampTool    :=     { 17,     1,      "RubberStamp",     kDragClick,    0,             {1,0,1,0,0,0,0,0}    };
  132.     global SmudgeTool         :=     { 18,     1,      "Smudge",         kMultiDrag,    0,             {1,0,1,0,0,0,0,0}    };
  133.     global BlurTool             :=     { 19,     1,      "Blur",         kMultiDrag,    0,             {1,0,1,0,0,0,0,0}    };
  134.     global DodgeTool         :=     { 20,     1,      "Dodge",         kMultiDrag,    0,             {1,0,1,0,0,0,0,0}    };
  135.     global StndWindowsTool    :=    { 1,    2,     "StandardWindows", 0,            0,            {0}                    };
  136.     global FullScrnMBarTool    :=    { 2,    2,     "FullScreenWithMenuBar",0,        0,            {0}                    };
  137.     global FullScrnNoMBarTool :={ 3,    2,     "FullScreenNoMenuBar", 0,        0,            {0}                    };
  138.  
  139.         ### List of Tools to use by DoDraw()
  140.     global gToolList :=    {    
  141.                             MarqueeTool, 
  142.                             LassoTool,
  143.                             HandTool,
  144.                             ZoomTool,
  145.                             MoveTool,
  146.                             HandTool,
  147.                             ZoomTool,
  148.                             CropTool,
  149.                             PaintBucketTool,
  150.                             GradientFillTool,
  151.                             LineTool,
  152.                             EyeDropperTool,
  153.                             EraserTool,
  154.                             PencilTool,
  155.                             AirbrushTool,
  156.                             PaintBrushTool,
  157.                             SmudgeTool,
  158.                             BlurTool,
  159.                             DodgeTool
  160.                         };
  161.     
  162.     
  163.         ### Font characteristic lists
  164.     #global gFontList := {'Chicago','Courier','Geneva','Helvetica','Monaco','New York','Palatino',Symbol','Times'};
  165.     global gFontList := BuildListFromResourcePhotoShop(gScriptResourceBase+1);
  166.     #global gFontSizeList := {'4','9','10','12','14','18','24','48'};
  167.     global gFontSizeList := BuildListFromResourcePhotoShop(gScriptResourceBase+2);
  168.     #global gFontStyleList := {'Bold','Italic','Underline','Outline','Shadow','Anti-Aliased'};
  169.     global gFontStyleList := BuildListFromResourcePhotoShop(gScriptResourceBase+3);
  170.     
  171.         ### Name of the Plain (style) menu item  ####
  172.     global gPlainStyle := '';    # there is no Plain style
  173.  
  174.         ### How to get to the next line
  175.     global gNextLineMethod := 1;            
  176.         ### 1 - ReturnKey,  2 - EnterKey, 3 - DownArrow Key, 4 - TabKey, {} - Move/Click, {'Untitled'} - Move relative to the window titled 'Untitled' /Click
  177.  
  178.         ### Does moving to the next line clear all font info
  179.     global gNextLineClearsFontSettings := 1;
  180.         ### 0 - font settings cleared on next line, 1 - font settings not cleared on next line
  181.  
  182.         ### Set Window tests    
  183.     global gDoWindowList:= {1,0,0,1};
  184.         # Set each element to 1 or 0.  Flag for performing DoWindows tests as follows:
  185.         # Element:      1 - Sizing
  186.         #             2 - Scrolling
  187.         #             3 - Dragging
  188.         #             4 - Zooming    
  189.  
  190.  
  191.     #############  Define Application Specific Hooks  #############
  192.     global gDoSetUpAppHook1 := task HandleDialogsHook;
  193.     global gCustomScrapText := task CustomScrapText;
  194.     global gCustomScrapPict := task CustomScrapPict;
  195.     global gSetupDoText := task SetupTextTests;
  196.     global gSetFont := task SetPhotoshopFont;
  197.     global gSetSize := task SetPhotoshopSize;
  198.     global gSetStyle := task SetPhotoshopStyle;
  199.     global gDoTextTypeStrHook1 := task PhotoshopPreTypeStr;
  200.     global gReportSelectedMenuItems := task ReportPhotoshopFontItems;
  201.     global gNextLine := task SetupTextTests;
  202.     global gSetLine := task SetPhotoshopLine;
  203.     global gSetColor := task SetPhotoshopColor;
  204.     global gSetBackgroundColor := task SetPhotoshopBackgroundColor;
  205.     global gModifyDocument := task ModifyForRevertHook;
  206.     global gDoCloseAppHook2 := task PrintForCloseHook;
  207.  
  208. end; # InitAppGlobals
  209.  
  210.  
  211. #########################################################################
  212. #                        BuildListFromResourcePhotoShop( idNum )
  213. #========================================================================
  214. # Author:        KTA 
  215. # Description:    Returns a list generated from all of the strings in a specified
  216. #                string list resource specified by <idNum>.
  217. # Parameters:    idNum := resource id number for the string list resource.
  218. # Returns:        list - all strings in specified string list resource.
  219. # Examples:        BuildListFromResourcePhotoShop( 1000 ); 
  220. # Assumptions:    This task must be contained within the same file that contains
  221. #                the resources. Currently this task only supports up to 100 strings
  222. #                in a single str# resource.
  223. # Note:            A duplicate of this task exists in 'Globals.Lib'.  The reason
  224. #                for this is that Vu has a limitation in the way it handles 
  225. #                resources in that it requires that a full path to the file be
  226. #                provided or the resources exist in the current file.  Since we
  227. #                do not have access to a fullpath, and do not want to require
  228. #                all users to name their hard drives and folders the same, we
  229. #                opted to place a duplicate copy of this task in all files that 
  230. #                want to use it.  The naming convesion is to append the name
  231. #                of the application under test to the end of the task name.
  232. #                For example, BuildListFromResourceMacDraw()
  233. #========================================================================
  234. # History: 10/09/95    Sarath A    Modified for FileMaker Pro 2.1v3
  235. #
  236. #########################################################################
  237. task BuildListFromResourcePhotoShop(idNum)
  238. begin
  239.     numtimes := 100;    #Assumes no resource will contain more than 100 strings
  240.     theList := {};
  241.     for i := 1 to numtimes
  242.     begin
  243.         CurrentFont := GetIndString(idNum,i);
  244.         #Println "This is the currentFont - ", currentFont;
  245.         if (isUndefined(CurrentFont))
  246.             numtimes := i;
  247.         else
  248.             theList := Insert(CurrentFont,Card(theList)+1, theList);
  249.     end;
  250.     #println "This is theList - ", theList;
  251.     return(theList);
  252. end; # BuildListFromResourcePhotoShop
  253.  
  254.  
  255. #########################################################################
  256. #                            HandleDialogsHook()
  257. #========================================================================
  258. # Author:        Mona Chow
  259. # Description:    Hide Brushes, Picker and Layers Palette if any of them is
  260. #                shown currently.  Then creates a new document.  First if
  261. #                statement below checks for low memory dialog.
  262. # Parameters:    None
  263. # Returns:        Nothing
  264. # Examples:        HandleDialogsHook();
  265. # Assumptions:    None 
  266. #========================================================================
  267. # History:
  268. #   GO'S 02/15/96   Updated MoveRelativeToWindow() coordinates to be window bound.
  269. #    ML     02/14/96    Corrected resource problems and localised some statements.
  270. #    MDF 08/24/95    Replaced match statements with await_presence.
  271. #########################################################################
  272. task HandleDialogsHook()
  273. begin
  274.     ### MDF:  Added to check for low memory dialog.
  275.     if( await_presence([window o:1 k:{[button t:GetIndString(global gScriptResourceBase+4,13)],
  276.                          [button t:GetIndString(global gScriptResourceBase+4,14)]}],30) ) # "Continue", "Quit"
  277.         SelectButton(GetIndString(global gScriptResourceBase+4,13));    #    "Continue"
  278.  
  279.     if ( await_presence([staticText t:GetIndString(global gScriptResourceBase+4,2) w:1],20) )    # Static text is: "Please locate the plug-ins folder:"
  280.        DialogDismisser(GetIndString(global gScriptResourceBase+4,3));                            # Select 'None' button
  281.     
  282.     
  283.     if( _matchBoolean([menuitem t:GetIndString(global gScriptResourceBase+4,4)]) )        # 'Hide Brushes'
  284.         SelectMenuItem(GetIndString(global gScriptResourceBase+4,4), GetIndString(global gScriptResourceBase+4,7), GetIndString(global gScriptResourceBase+4,8));
  285.                     # 'Hide Brushes','Palettes','Window'
  286.  
  287.     if( _matchBoolean([menuitem t:GetIndString(global gScriptResourceBase+4,5)]) )        # 'Hide Picker'
  288.         SelectMenuItem(GetIndString(global gScriptResourceBase+4,5), GetIndString(global gScriptResourceBase+4,7), GetIndString(global gScriptResourceBase+4,8));
  289.                     # 'Hide Picker','Palettes','Window'
  290.     
  291.     if( _matchBoolean([menuitem t:GetIndString(global gScriptResourceBase+4,6)]) )        # 'Hide Layers'
  292.         SelectMenuItem(GetIndString(global gScriptResourceBase+4,6), GetIndString(global gScriptResourceBase+4,7), GetIndString(global gScriptResourceBase+4,8));
  293.                     # 'Hide Layers','Palettes','Window'
  294.  
  295.     LogStr('Brushes, Picker and Layers palette are now hidden.');
  296.     
  297. end; # HandleDialogsHook
  298.  
  299.  
  300. #########################################################################
  301. #                            CustomScrapText()
  302. #========================================================================
  303. # Author:        MDF
  304. # Description:    Performs the scrapbook test for text.  Needed because in order
  305. #                to do this test, text tool has to be clicked in the document
  306. #                and the text is pasted into a dialog which is then cleared.
  307. # Parameters:    None
  308. # Returns:        Nothing
  309. # Examples:        CustomScrapText();
  310. # Assumptions:    None 
  311. #========================================================================
  312. # History:
  313. #    03/07/96    MDF        Created.
  314. #########################################################################
  315. task CustomScrapText()
  316. begin
  317.     global gScriptResourceBase, gPrevAppTitle, gIntegration, kScrapTEXT,
  318.            kScrapPICT, gAppTitle, gScrapTitle;
  319.            
  320.     temp := gIntegration;    
  321.     Integration := 0;            #To turn off global Integration - KTA
  322.     tempgBackgroundQuit:= global gBackgroundQuit;
  323.     gBackgroundQuit:= 0;
  324.     tempgForceQuit:= global gForceQuit;
  325.     gForceQuit:= 0;
  326.     tempgFillMemory:= global gFillMemory;
  327.     gFillMemory:= 0;
  328.     LogStr( "==========================================================");
  329.     LogStr("Performing Scrapbook DA test.");
  330.     returnval:=0;
  331.     failStr := '';
  332.     ScrapDescriptor := '';
  333.     ccpFlag := 1;        # default as set in Scrapbook()
  334.     pasteFlag := 1;        # default as set in Scrapbook()
  335.     requestElement := kScrapTEXT;
  336.     TCSNUM := 2;
  337.  
  338.     TCSStart({ TCSNUM, global kTCSetScrapBook }, 'ScrapBook');
  339.     
  340.     if not(gAppTitle)
  341.         MatchApplication(0);
  342.     if(LaunchTwitch(gScrapTitle,,,0))
  343.     begin
  344.         LogStr("Opened the Scrapbook");
  345.         scBook := _match ([window t:gScrapTitle o:1]!,1);
  346.         if(scBook.k[1].t = 'Play Sound') #put in fix for 7.0ß4 where sound button is control [1]
  347.             SkrollBar := scBook.k[2];
  348.         else
  349.             SkrollBar := scBook.k[1];
  350.         status := SkrollBar.s;
  351.         if (status <> { 0, -1 })
  352.         begin                                        # if scrollbar is enabled...
  353.             error := 0;                                # no errors yet
  354.             elementCount := status[2] + 1;            # elementCount = number of scrapbook elements
  355.             currentElement := status[1] + 1;        # currentElement = current position in Scrapbook
  356.             newCount := elementCount + 1;
  357.             if (requestElement>elementCount) begin    # if position is greater than total elements in Scrapbook.. 
  358.                 if (ccpFlag = 1)
  359.                     LogStr("!@#$% Scrapbook entry {requestElement} does not exist! - Copying entry {currentElement} of {elementCount}");
  360.                 else if (ccpFlag = 3)
  361.                     LogStr("!@#$% Scrapbook entry {requestElement} does not exist! - Pasting to entry {currentElement} of {newCount}");
  362.                 else begin
  363.                     LogStr("!@#$% Can∂'t Cut/Clear - Scrapbook entry {requestElement} does not exist! Closing Scrapbook!");
  364.                     error := 1;    # don't clear or cut if requested item not there
  365.                 end;
  366.             end;
  367.             else begin# we've got a valid Scrapbook entry
  368.             _scroll (SkrollBar, 'a', {requestElement,elementCount});
  369.                 try match [scrollbar s:?status]!;
  370.                 catch theError
  371.                     ExceptionDispatcher(theError);
  372.                 currentElement := status[1] + 1;        # currentElement = current position in Scrapbook
  373.                 LogStr("Scrolled to item {currentElement} of {elementCount} of the ScrapBook");
  374.                 wait(1);
  375.             end;
  376.                 
  377.             if (not error) begin
  378.                 if (ccpFlag = 1) begin    # Copy Item
  379.                     if not( SelectMenuItem(4, 3))    # error - couldn't copy
  380.                         error := 1;        # prepare to abort
  381.                 end;
  382.                 else if (ccpFlag = 2)  begin
  383.                     if (not SelectMenuItem(3, 3))    # error - couldn't cut    
  384.                         error := 1;        # prepare to abort
  385.                 end;
  386.                 else if (ccpFlag = 3)  begin
  387.                     if (not SelectMenuItem(5, 3))    # error - couldn't cut    
  388.                         error := 1;        # prepare to abort
  389.                     else
  390.                         LogStr("Pasted to entry {currentElement} of {newCount}");                        
  391.                 end;
  392.                 else if (ccpFlag = 4)  begin
  393.                     if (not SelectMenuItem(6, 3))    # error - couldn't clear    
  394.                         error := 1;        # prepare to abort
  395.                 end;
  396.             end;
  397.             wait(2);
  398.             tempTargetInfo := global gAdditionalTargetInfo;
  399.             global gAdditionalTargetInfo := 0;
  400.             LaunchTwitch(gPrevAppTitle,,0);        # Twitch to it but don't launch it
  401.             global gAdditionalTargetInfo := tempTargetInfo;
  402.  
  403.             if not (error)
  404.             begin
  405.                 if (pasteFlag)
  406.                 begin    # if we're supposed to paste back into document, do it
  407.                     wait(3);
  408.                     Draw(global TypeTool,,,,,[window t:/≈RGB≈/]);   # partial title of window before it's been saved
  409.                     if( await_presence([window t:'Type Tool' o:1],60) )
  410.                     begin
  411.                         keyEq('v');
  412.                         LogStr("==========================================================");
  413.                         SpecialKey(EnterKey,"Enter Key - Clears 'Type Tool' dialog");
  414.                         if( await_absence([window t:'Type Tool' o:1],60) )
  415.                             returnVal := CurrentElement;
  416.                         else
  417.                         begin
  418.                             returnVal := 0;
  419.                             failStr := "Could not dismiss 'Type Tool' dialog by hitting return";
  420.                             logStr(failStr);
  421.                             DialogDismisser();
  422.                         end;
  423.                     end;
  424.                     else
  425.                     begin
  426.                         returnVal := 0;
  427.                         failStr := "'Type Tool' dialog failed to appear, could not paste text";
  428.                         logStr(failStr);
  429.                     end;
  430.                 end;
  431.             end;
  432.         end; # if scrollbar is enabled...
  433.         else begin
  434.             failStr := '!@#$% The horizontal scroll bar was not enabled to scroll';
  435.             LogStr(failStr);
  436.             closeWindow();
  437.         end;
  438.     end; # If(LaunchTwitch('Scrapbook'))
  439.     else
  440.     begin
  441.         scrapReturn := -1;        # couldn't launch is an expected failure
  442.         LaunchTwitch(gPrevAppTitle,,0);        # Twitch to it but don't launch it
  443.         failStr := "Couldn't launch the Scrapbook";
  444.     end;
  445.     
  446.     if (returnVal)    # Return pass or fail
  447.     begin
  448.         ScrapReturn := 1;
  449.         ScrapDescriptor := returnVal;
  450.     end;
  451.     else
  452.     begin
  453.         if not(scrapReturn = -1)    # Couldn't launch
  454.             ScrapReturn := 0;
  455.     end;
  456.     
  457.     SetTool(global MarqueeTool);
  458.     logStr("Click in the document window to disable text selection...");
  459.     MoveRelativeToWindow(5,5,[window t:/≈RGB≈/],2);     # deselects text
  460.     
  461.     TCSEnd({ TCSNUM, global kTCSetScrapBook }, ScrapReturn,failStr,,ScrapDescriptor);            # End TCS
  462.     gBackgroundQuit:= tempgBackgroundQuit;
  463.     gForceQuit:= tempgForceQuit;
  464.     gFillMemory:= tempgFillMemory;
  465.     gIntegration := temp;            #To reset the integration global - KTA
  466.  
  467.     return(returnval);
  468. end; # CustomScrapText
  469.  
  470.  
  471. #########################################################################
  472. #                            CustomScrapPict()
  473. #========================================================================
  474. # Author:        MDF
  475. # Description:    Performs the scrapbook test for Pict.  This is needed because
  476. #                the marquee around the pasted object in the document window
  477. #                has to be deselected.
  478. # Parameters:    None
  479. # Returns:        Nothing
  480. # Examples:        CustomScrapPict();
  481. # Assumptions:    None 
  482. #========================================================================
  483. # History:
  484. #    03/07/96    MDF        Created.
  485. #########################################################################
  486. task CustomScrapPict()
  487. begin
  488.     Scrapbook(global kscrapPict);
  489.     SetTool(global MarqueeTool);
  490.     logStr("Click in the document window to disable text selection...");
  491.     MoveRelativeToWindow(5,5,[window t:/≈RGB≈/],2);     # deselects text
  492. end; # CustomScrapPict
  493.  
  494.  
  495. #########################################################################
  496. #                    SetupTextTests(pTestMethod, pNumTimes)
  497. #========================================================================
  498. # Author:        MDF
  499. # Description:    Selects the TypeTool for and clicks in a random location in the
  500. #                document window.  Style settings are also cleared here for calls
  501. #                to gNextLine
  502. # Parameters:    pTestMethod - the method of testing desired.
  503. #                            1 - Random font test
  504. #                            2 - QuickLook font test
  505. #                            3 - WaterFall font test
  506. #                pNumTimes - (integer) number of times to perform the <pTestMethod>.
  507. #                            (not valid for WaterFall testing)
  508. # Returns:        Nothing
  509. # Examples:        SetupTextTests();
  510. # Assumptions:    None 
  511. #========================================================================
  512. # History:
  513. #    03/08/96    MDF        Created.
  514. #########################################################################
  515. task SetupTextTests(pTestMethod := -1, pNumTimes := 1)
  516. begin
  517.     global gScriptResourceBase, gFontStyleList;
  518.     
  519.     SetTool(global TypeTool);
  520.     MoveRelativeToWindow(,,[window t:/≈RGB≈/],2);  # clicks in document window (random)
  521.     
  522.     if( await_presence([window t:'Type Tool' o:1],120) )
  523.     begin
  524.         windBRect := (_match([window t:'Type Tool' o:1])).b;
  525.  
  526.         for each style in gFontStyleList
  527.         begin
  528.             _move('a',{0,0});    # move cursor out of search area
  529.             logStr("Checking to see if styles need to be deselected...");
  530.             switch style
  531.             begin
  532.                 case GetIndString(gScriptResourceBase+3,1):        # 'Bold'
  533.                     styleRect := {28,138,47,155};    # rel to content rgn
  534.                 case GetIndString(gScriptResourceBase+3,2):        # 'Italic'
  535.                     styleRect := {28,158,47,172};    # rel to content rgn
  536.                 case GetIndString(gScriptResourceBase+3,3):        # 'Underline'
  537.                     styleRect := {28,175,47,191};    # rel to content rgn
  538.                 case GetIndString(gScriptResourceBase+3,4):        # 'Outline'
  539.                     styleRect := {140,138,156,155};    # rel to content rgn
  540.                 case GetIndString(gScriptResourceBase+3,5):        # 'Shadow'
  541.                     styleRect := {140,158,156,172};    # rel to content rgn
  542.                 case GetIndString(gScriptResourceBase+3,6):        # 'Anti-Aliased'
  543.                     styleRect := {140,175,156,191};    # rel to content rgn
  544.             end;
  545.  
  546.             styleSearchRect := {windBRect[1]+styleRect[1],windBRect[2]+styleRect[2],
  547.                                    windBRect[1]+styleRect[3],windBRect[2]+styleRect[4]};
  548.                                         # styleRect converted from local coords
  549.                                         # to screen coords
  550.             
  551.             _match([screen]);    # do this BEFORE calling locateImage()
  552.             styleChkboxRect := locateImage(,styleSearchRect,201);
  553.             if(styleChkboxRect)
  554.             begin
  555.                 clickPoint := CenterPointOfRect(styleChkboxRect);
  556.                 logStr("Deselecting the '{style}' checkbox by coordinates...");
  557.                 MoveMouse(clickPoint[1],clickPoint[2],,2);
  558.             end;
  559.         end;
  560.         logStr("Finished checking style checkboxes.");
  561.         SpecialKey(DeleteKey,"Delete Key - clear the text in the text entry box");
  562.         SpecialKey(EnterKey,"Enter Key - close the 'Type Tool' dialog");
  563.     end;        
  564. end; # SetupTextTests
  565.  
  566.  
  567. #########################################################################
  568. #                    SetPhotoshopFont(pMyFont, pObjectNumber)
  569. #========================================================================
  570. # Author:        MDF
  571. # Description:    Selects pMyFont from the Font popup in the 'Type Tool' dialog.
  572. # Parameters:    pMyFont - Name of the font.
  573. #                pObjectNumber - Integer used to track all elements that make up 
  574. #                                an Font record - TCS related.
  575. # Returns:        returns what SelectMenuItem returns 
  576. #                    0 - failure
  577. #                    String - success
  578. # Examples:        SetPhotoshopFont('Geneva');
  579. # Assumptions:    That InitFonts() has been called thus global gCurrFontMenu
  580. #                is set to the name of the menus which contain <pMyFont>.  Also
  581. #                requires the 'Type Tool' dialog to be present.
  582. #========================================================================
  583. # History:
  584. #    03/08/96    MDF        Created.
  585. #########################################################################
  586. task SetPhotoshopFont(pMyFont := '', pObjectNumber := 'NA')
  587. begin
  588.     global gScriptResourceBase;
  589.     
  590.     failStr := "";
  591.     myReturn := 0;
  592.  
  593.         # coords rel to upper left corner of content region
  594.     fontPopupClickPoint := {161,22};    # this point causes the font popup to display it's contents
  595.     popUpDisplayRect := {78,-67,181,159};    # rect to search for font names in the font popup
  596.     
  597.     TCSStart({ 1, global kTCSetFont},"SetFont");    # Start TCS
  598.     
  599.     Draw(global TypeTool);
  600.     if( await_presence([window t:'Type Tool' o:1],60) )
  601.     begin
  602.         windBRect := (_match([window t:'Type Tool' o:1])).b;
  603.         searchRect := {windBRect[1]+popUpDisplayRect[1],
  604.                        windBRect[2]+popUpDisplayRect[2],
  605.                        windBRect[1]+popUpDisplayRect[3],
  606.                        windBRect[2]+popUpDisplayRect[4]};
  607.         _match([screen]);    # do this BEFORE calling locateString()
  608.         MoveRelativeToWindow(fontPopupClickPoint[1],fontPopupClickPoint[2],
  609.                              [window t:'Type Tool' o:1]);    # move over popup
  610.         MoveMouse(windBRect[1]+161,0,[window t:'Type Tool' o:1],3);
  611.         position := locateString(pMyFont,searchRect,
  612.                                  GetIndString(gScriptResourceBase+1,1),12);
  613.         if(position)    # found it
  614.         begin
  615.             logStr("Selecting '{pMyFont}' in the font popup...");
  616.             MoveMouse(position[1],position[2],,4);
  617.             myReturn := 1;
  618.         end;
  619.         else
  620.         begin    # could not find font
  621.             myReturn := 0;
  622.             failStr := "Couldn't locate '{pMyFont}' in the font popup";
  623.             logStr(failStr);
  624.             _ReleaseMouse();
  625.         end;
  626.     end;
  627.     else
  628.     begin
  629.         myReturn := 0;
  630.         failStr := "The 'Type Tool' dialog was not present, could not select fonts";
  631.         logStr(failStr);
  632.     end;
  633.         
  634.     TCSEnd({ 1, global kTCSetFont},myReturn,failStr,pObjectNumber,pMyFont);
  635.     return(myReturn);
  636.     
  637. end; # SetPhotoshopFont
  638.  
  639.  
  640. #########################################################################
  641. #                    SetPhotoshopSize(pMySize, pObjectNumber)
  642. #========================================================================
  643. # Author:        MDF
  644. # Description:    Sets the currently selected font size to <pMySize> in the size
  645. #                text entry box of the 'Type Tool' dialog.
  646. # Parameters:    pMySize - Name of the size.
  647. #                pObjectNumber - Integer used to track all elements that make up 
  648. #                                an Font record - TCS related.
  649. # Returns:        returns what SelectMenuItem returns 
  650. #                    0 - failure
  651. #                    String - success
  652. # Examples:        SetPhotoshopSize('10');
  653. # Assumptions:    That InitFonts() has been called thus global gCurrSizeMenu
  654. #                is set to the name of the menus which contain <pMySize>.  Also
  655. #                requires the 'Type Tool' dialog to be present.
  656. #========================================================================
  657. # History:
  658. #    03/08/96    MDF        Created.
  659. #########################################################################
  660. task SetPhotoshopSize(pMySize := '', pObjectNumber := 'NA')
  661. begin
  662.     global gScriptResourceBase;
  663.     
  664.     failStr := '';
  665.     myReturn := 0;
  666.     
  667.     sizeBoxLoc := {121,43};   # point to click in the size box
  668.     
  669.     TCSStart({ 2, global kTCSetFont },"SetSize");        # Start TCS
  670.     
  671.     if( await_presence([window t:'Type Tool' o:1],60) )
  672.     begin
  673.         logStr("Hiliting the size text entry box...");
  674.         MoveRelativeToWindow(sizeBoxLoc[1],sizeBoxLoc[2],
  675.                              [window t:'Type Tool' o:1]);    # to size box
  676.         MoveMouse(-49,0,0,1);    # move to the left with mousedown, hilites size box
  677.         TypeStr(pMySize);
  678.         myReturn := 1;
  679.     end;
  680.     else
  681.     begin
  682.         myReturn := 0;
  683.         failStr := "The 'Type Tool' dialog was not present, could not select sizes";
  684.         logStr(failStr);
  685.     end;
  686.         
  687.     TCSEnd({ 2, global kTCSetFont },myReturn,failStr,pObjectNumber,pMySize);
  688.     return(myReturn);
  689.     
  690. end; # SetPhotoshopSize
  691.  
  692.  
  693. #########################################################################
  694. #                    SetPhotoshopStyle(pMyStyle, pObjectNumber)
  695. #========================================================================
  696. # Author:        MDF
  697. # Description:    Sets the currently selected font style to <pMyStyle> in the
  698. #                'Type Tool' dialog.
  699. # Parameters:    pMyStyle - Name of the Style.
  700. #                pObjectNumber - Integer used to track all elements that make up 
  701. #                                an Font record - TCS related.
  702. # Returns:        returns what SelectMenuItem returns 
  703. #                    0 - failure
  704. #                    String - success
  705. # Examples:        SetPhotoshopStyle('Bold');
  706. # Assumptions:    That InitFonts() has been called thus global gCurrStyleMenu
  707. #                is set to the name of the menus which contain <pMyStyle>.  Also
  708. #                requires the 'Type Tool' dialog to be present.
  709. #========================================================================
  710. # History:
  711. #    03/08/96    MDF        Created.
  712. #########################################################################
  713. task SetPhotoshopStyle(pMyStyle := '', pObjectNumber := 'NA')
  714. begin
  715.     global gScriptResourceBase;
  716.     
  717.     failStr := "";
  718.     myReturn := 0;
  719.  
  720.     TCSStart({ 1, global kTCSetFont},"SetFont");    # Start TCS
  721.     
  722.     if( await_presence([window t:'Type Tool' o:1],60) )
  723.     begin
  724.         windBRect := (_match([window t:'Type Tool' o:1])).b;
  725.         _move('a',{0,0});    # move cursor out of search area
  726.         switch pMyStyle
  727.         begin
  728.             case GetIndString(gScriptResourceBase+3,1):        # 'Bold'
  729.                 styleRect := {28,138,47,155};    # rel to content rgn
  730.             case GetIndString(gScriptResourceBase+3,2):        # 'Italic'
  731.                 styleRect := {28,156,47,172};    # rel to content rgn
  732.             case GetIndString(gScriptResourceBase+3,3):        # 'Underline'
  733.                 styleRect := {28,175,47,191};    # rel to content rgn
  734.             case GetIndString(gScriptResourceBase+3,4):        # 'Outline'
  735.                 styleRect := {140,138,156,155};    # rel to content rgn
  736.             case GetIndString(gScriptResourceBase+3,5):        # 'Shadow'
  737.                 styleRect := {140,158,156,172};    # rel to content rgn
  738.             case GetIndString(gScriptResourceBase+3,6):        # 'Anti-Aliased'
  739.                 styleRect := {140,175,156,191};    # rel to content rgn
  740.         end;
  741.  
  742.         styleSearchRect := {windBRect[1]+styleRect[1],windBRect[2]+styleRect[2],
  743.                                windBRect[1]+styleRect[3],windBRect[2]+styleRect[4]};
  744.                                         # styleRect converted from local coords
  745.                                         # to screen coords
  746.         
  747.         _match([screen]);    # do this BEFORE calling locateImage()
  748.         imageRect := locateImage(,styleSearchRect,200);
  749.         if(imageRect)
  750.         begin
  751.             clickPoint := CenterPointOfRect(imageRect);
  752.             logStr("Selecting '{pMyStyle}' checkbox by coordinates...");
  753.             MoveMouse(clickPoint[1],clickPoint[2],,2);
  754.             myReturn := 1;
  755.         end;
  756.         else
  757.         begin
  758.             myReturn := 0;
  759.             failStr := "Could not locate '{pMyStyle}' style checkbox in the 'Type Tool' dialog";
  760.             logStr(failStr);
  761.         end;
  762.     end;
  763.     else
  764.     begin
  765.         myReturn := 0;
  766.         failStr := "The 'Type Tool' dialog was not present, could not select styles";
  767.         logStr(failStr);
  768.     end;
  769.         
  770.     TCSEnd({ 1, global kTCSetFont},myReturn,failStr,pObjectNumber,pMyStyle);
  771.     return(myReturn);
  772.     
  773. end; # SetPhotoshopStyle
  774.  
  775.  
  776. #########################################################################
  777. #                    PhotoshopPreTypeStr(pTestMethod, pNumTimes)
  778. #========================================================================
  779. # Author:        MDF
  780. # Description:    Called just before entering gTextStr in DoText().  This task
  781. #                will tab to the text entry box in the 'Type Tool' dialog.
  782. # Parameters:    pTestMethod - the method of testing desired.
  783. #                            1 - Random font test
  784. #                            2 - QuickLook font test
  785. #                            3 - WaterFall font test
  786. #                pNumTimes - (integer) number of times to perform the <pTestMethod>.
  787. #                            (not valid for WaterFall testing)
  788. # Returns:        nada
  789. # Examples:        ReportPhotoshopFontItems({{'Format','Font'},{'Format','Styles'});
  790. # Assumptions:    
  791. #========================================================================
  792. # History:
  793. #    03/08/96    MDF        Created.
  794. #########################################################################
  795. task PhotoshopPreTypeStr(pTestMethod, pNumTimes)
  796. begin
  797.     logStr("Tabbing to the text entry field...");
  798.     SpecialKey(TabKey,"Tab Key",3);
  799. end; # PhotoshopPreTypeStr
  800.  
  801.  
  802. #########################################################################
  803. #                    ReportPhotoshopFontItems(pMenuList, pObjectNumber)
  804. #========================================================================
  805. # Author:        MDF
  806. # Description:    Collects all the menu items with a markChar ('') from the 
  807. #                defined menus defined in pMenuList. Then types each marked item 
  808. #                and calls NextLine() to move to the next text entry line.
  809. # Parameters:    pMenuList - List of lists/strings 
  810. #                    List of menus containing marked menuitems. 
  811. #                pObjectNumber - Integer - used to track all elements that make up 
  812. #                                an Font record - TCS related.
  813. # Returns:        nada
  814. # Examples:        ReportPhotoshopFontItems({{'Format','Font'},{'Format','Styles'});
  815. # Assumptions:    
  816. #========================================================================
  817. # History:
  818. #    03/08/96    MDF        Created.
  819. #########################################################################
  820. task ReportPhotoshopFontItems(pMenuList, pObjectNumber := '')
  821. begin
  822.     global gFontList, gFontSizeList, gFontStyleList, gScriptResourceBase;
  823.  
  824.     failStr := '';
  825.     selectedItems := "";            # Init selectedItems
  826.     
  827.     if( await_presence([window t:'Type Tool' o:1],60) )
  828.     begin
  829.         ##Check to see if duplicate items in pMenuList
  830.         tempList := {};
  831.         for each fontRec in pMenuList
  832.         begin
  833.             if( not isMember(fontRec, tempList) )
  834.                 tempList := Insert(fontRec, Card(tempList)+1, tempList);
  835.         end;
  836.         pMenuList := tempMenuList;
  837.         
  838.         ##What font is selected ?
  839.         fontIndex := 1;     # initialize
  840.         fontNotFound := 1;    # initialize
  841.         fontTypeRect := {77,12,183,32};    # coords rel to content region of 'Type Tool' dialog
  842.         windBRect := (_match([window t:'Type Tool' o:1])).b;
  843.         fontSearchRect := {windBRect[1]+fontTypeRect[1],windBRect[2]+fontTypeRect[2],
  844.                               windBRect[1]+fontTypeRect[3],windBRect[2]+fontTypeRect[4]};
  845.         while(fontNotFound)
  846.         begin
  847.             _match([screen]);    # do this BEFORE calling locateString()
  848.             fontPosition := locateString(gFontList[fontIndex],fontSearchRect,
  849.                                             GetIndString(gScriptResourceBase+1,1),12);
  850.             if(fontPosition)    # found the font
  851.             begin
  852.                 fontNotFound := 0;
  853.                 selectedItems := "{gFontList[fontIndex]}";
  854.             end;
  855.             else
  856.                 if( fontIndex = card(gFontList) )
  857.                     fontIndex := 1;        # re-initialize
  858.                 else
  859.                     fontIndex := fontIndex + 1;
  860.         end;
  861.         
  862.         ##What size is used?
  863.         sizeIndex := 1;     # initialize
  864.         sizeNotFound := 1;    # initialize
  865.         sizeBoxRect := {76,35,126,58};    # coords rel to content region of 'Type Tool' dialog
  866.         sizeSearchRect := {windBRect[1]+sizeBoxRect[1],windBRect[2]+sizeBoxRect[2],
  867.                               windBRect[1]+sizeBoxRect[3],windBRect[2]+sizeBoxRect[4]};
  868.         while(sizeNotFound)
  869.         begin
  870.             _match([screen]);    # do this BEFORE calling locateString()
  871.             sizePosition := locateString(gFontSizeList[sizeIndex],sizeSearchRect,
  872.                                          GetIndString(gScriptResourceBase+1,1),12);
  873.             if(sizePosition)    # found the size
  874.             begin
  875.                 sizeNotFound := 0;
  876.                 selectedItems := "{selectedItems}-{gFontSizeList[sizeIndex]}";
  877.             end;
  878.             else
  879.                 if( sizeIndex = card(gFontSizeList) )
  880.                     sizeIndex := 1;        # re-initialize
  881.                 else
  882.                     sizeIndex := sizeIndex + 1;
  883.         end;
  884.         
  885.         ##Gather the selected styles
  886.         for each style in gFontStyleList
  887.         begin
  888.             _move('a',{0,0});    # move cursor out of search area
  889.             switch style
  890.             begin
  891.                 case GetIndString(gScriptResourceBase+3,1):        # 'Bold'
  892.                     styleRect := {28,138,47,155};    # rel to content rgn
  893.                 case GetIndString(gScriptResourceBase+3,2):        # 'Italic'
  894.                     styleRect := {28,158,47,172};    # rel to content rgn
  895.                 case GetIndString(gScriptResourceBase+3,3):        # 'Underline'
  896.                     styleRect := {28,175,47,191};    # rel to content rgn
  897.                 case GetIndString(gScriptResourceBase+3,4):        # 'Outline'
  898.                     styleRect := {140,138,156,155};    # rel to content rgn
  899.                 case GetIndString(gScriptResourceBase+3,5):        # 'Shadow'
  900.                     styleRect := {140,158,156,172};    # rel to content rgn
  901.                 case GetIndString(gScriptResourceBase+3,6):        # 'Anti-Aliased'
  902.                     styleRect := {140,175,156,191};    # rel to content rgn
  903.             end;
  904.  
  905.             styleSearchRect := {windBRect[1]+styleRect[1],windBRect[2]+styleRect[2],
  906.                                    windBRect[1]+styleRect[3],windBRect[2]+styleRect[4]};
  907.                                     # styleRect converted from local coords
  908.                                     # to screen coords
  909.             
  910.             _match([screen]);    # do this BEFORE calling locateImage()
  911.             styleRect := locateImage(,styleSearchRect,201);
  912.             if(styleRect)
  913.                 selectedItems := "{selectedItems}-{style}";
  914.         end;
  915.         
  916.         TCSStart({ 4, global kTCSetFont },"Type SelectedItems String");
  917.         
  918.         if(selectedItems)
  919.             TypeStr(selectedItems);                            # Type the selected menu items
  920.         else
  921.             TCSFlag := 0;                                    # Fail the TCS
  922.                 
  923.         SpecialKey(EnterKey,"Enter Key - closes the 'Type Tools' dialog");
  924.         if( await_absence([window t:"Type Tools" o:1],60) )
  925.         begin
  926.             logStr("Clicking in corner of doc window to complete text entry...");
  927.             SetTool(global MarqueeTool);
  928.             MoveRelativeToWindow(5,5,[window t:/≈RGB≈/],2);
  929.             TCSFlag := 1;
  930.         end;
  931.         else
  932.         begin
  933.             TCSFlag := 0;
  934.             failStr := "Could not close the 'Type Tools' dialog by pressing the return key";
  935.             logStr(failStr);
  936.             DialogDismisser('All',[window t:"Type Tools" o:1]);
  937.         end;
  938.     end;
  939.     else
  940.     begin
  941.         TCSFlag := 0;
  942.         failStr := "The 'Type Tool' dialog was not present, couldn't report font item selections";
  943.         logStr(failStr);
  944.     end;
  945.     TCSEnd({ 4, global kTCSetFont }, TCSFlag, failStr, pObjectNumber, selectedItems);    
  946.     
  947. end; # ReportPhotoshopFontItems
  948.  
  949.  
  950. #########################################################################
  951. #                SetPhotoshopLine(pTheLine, pSelectLine, pObjectNumber)
  952. #========================================================================
  953. # Author:        MDF
  954. # Description:    This is used when selecting line weights from a palette. 
  955. #                This task takes a LineStruct as a parameter. If the LineStruct
  956. #                evaluates to 'Random' a LineStruct will be generated randomly.
  957. #                If the pSelectLine evaluates to true the line will also be selected.
  958. #                Otherwise, the generated LineStruct will be returned without 
  959. #                selecting the line weight.  Overrides libs so that the 'Brushes'
  960. #                palette is removed.  This is done so that this palette does not
  961. #                interfere with drawing in the document window.
  962. # Parameters:    pTheLine - 0 - nothing done return 0
  963. #                        - Valid LineStruct
  964. #                        - 'Random' - generates a random LineStruct
  965. #                pSelectLine - Boolean flag which indicates whether or not to 
  966. #                            select the line.
  967. #                pObjectNumber - Integer used to track all elements that make up 
  968. #                                an object - TCS related.
  969. # Returns:        lineStruct - A valid LineStruct
  970. # Examples:        SetPhotoshopLine('Random', 1, 14);
  971. # Assumptions:    All draw related data structures set up properly.
  972. #========================================================================
  973. # History:
  974. #    03/08/96    MDF        Created.
  975. #########################################################################
  976. TASK SetPhotoshopLine(pTheLine := 'Random', pSelectLine := 1, pObjectNumber := 0) 
  977. begin
  978.     global gScriptResourceBase;
  979.     
  980.     if( _matchBoolean([menuitem t:"Show Brushes"]) )
  981.         SelectMenuItem("Show Brushes","Palettes","Window");
  982.     
  983.     lineStruct := SetPaletteItem(pTheLine, pSelectLine, "Line",
  984.                                  global kLinePaletteNum, pObjectNumber);
  985.                                  
  986.     if( _matchBoolean([menuitem t:"Hide Brushes"]) )
  987.         SelectMenuItem("Hide Brushes","Palettes","Window");
  988.         
  989.     return(lineStruct);
  990. end; # SetLine()
  991.  
  992.  
  993. #########################################################################
  994. #            SetPhotoShopColor(pTheColor, pSelectColor, pObjectNumber)
  995. #========================================================================
  996. # Author:        MDF
  997. # Description:    This is used when selecting colors from a palette.  This task
  998. #                takes a ColorStruct as a parameter. If the ColorStruct evaluates
  999. #                to 'Random' a ColorStruct will be generated randomly.  If the
  1000. #                pSelectColor evaluates to true the color will also be selected.
  1001. #                Otherwise, the generated ColorStruct will be returned without 
  1002. #                selecting the color.  Overrides libs because the proper color
  1003. #                swatch must be selected first and dialog check must
  1004. #                be done in order to set the background color.  Also removes
  1005. #                'Picker' palette so that it does not interfere with drawing in
  1006. #                the document window.  The color palette is assembled here
  1007. #                since the name of this window can change depending on the 
  1008. #                number of times the application has been launched.
  1009. # Parameters:    pTheColor - 0 - nothing done return 0
  1010. #                        - Valid ColorStruct
  1011. #                        - 'Random' - generates a random ColorStruct
  1012. #                pSelectColor - Boolean flag which indicates whether or not to 
  1013. #                            select the Color.
  1014. #                pObjectNumber - Integer used to track all elements that make up 
  1015. #                                an object - TCS related.
  1016. # Returns:        colStruct - A valid ColorStruct
  1017. # Examples:        SetPhotoShopColor('Random', 1, 14);
  1018. # Assumptions:    All draw related data structures set up properly.
  1019. #========================================================================
  1020. # History:
  1021. #    03/08/96    MDF        Created.
  1022. #########################################################################
  1023. task SetPhotoShopColor(pTheColor := 'Random', pSelectColor := 1,
  1024.                        pObjectNumber := 0)
  1025. begin
  1026.     global gScriptResourceBase, gPaletteList, kPalWind;
  1027.     
  1028.     if( _matchBoolean([menuitem t:"Show Picker"]) )
  1029.         SelectMenuItem("Show Picker","Palettes","Window");
  1030.     
  1031.     if( _matchBoolean([window t:"Picker"]) )
  1032.         colPalTitle := "Picker";
  1033.     if( _matchBoolean([window t:"Scratch"]) )
  1034.         colPalTitle := "Scratch";
  1035.         
  1036.     colPalList := 
  1037.         {
  1038.             {                    #### Start Palette #4 - Color (both foreground and background)
  1039.             {colPalTitle,90,2},    # Specifier, Top margin, left margin
  1040.             kPalWind,            # Palette type
  1041.             {200,18},            # Size {numElemsWide,numElemsTall}
  1042.             {1,1}                # Offset between tools {h,v}
  1043.             }                    #### End Palette #4 - Color (both foreground and background)
  1044.         };
  1045.         
  1046.     gPaletteList := gPaletteList + colPalList;
  1047.  
  1048.     logStr("Clicking on the foreground color swatch in the color palette...");
  1049.     MoveRelativeToWindow(172,36,[window t:colPalTitle],2);
  1050.     if( await_presence([window t:'Color Picker' o:1],60) )
  1051.     begin
  1052.         logStr("'Color Picker' dialog appeared, dimissing dialog by hitting cancel button...");
  1053.         DialogDismisser( 1,[window t:'Color Picker' o:1]);
  1054.     end;
  1055.     
  1056.     colStruct := SetPaletteItem(pTheColor, pSelectColor, "Color",
  1057.                                 global kColorPaletteNum, pObjectNumber);
  1058.                           
  1059.     if( _matchBoolean([menuitem t:"Hide Picker"]) )
  1060.         SelectMenuItem("Hide Picker","Palettes","Window");
  1061.         
  1062.     return(colStruct);
  1063.     
  1064. end; # SetPhotoShopColor
  1065.  
  1066.  
  1067. #########################################################################
  1068. #    SetPhotoshopBackgroundColor(pBackgroundColor, pSelectItem, pObjectNumber)
  1069. #========================================================================
  1070. # Author:        MDF
  1071. # Description:    This is used when selecting Background Colors from a palette. 
  1072. #                This task takes an element struct, item number, or "Random"
  1073. #                as a parameter.  If 'Random', an element struct will be
  1074. #                generated randomly.  If pSelectItem evaluates to true the
  1075. #                element struct will also be selected.  Overrides libs because
  1076. #                the proper color swatch must be selected first and dialog check
  1077. #                must be done in order to set the background color.  Also removes
  1078. #                'Picker' palette so that it does not interfere with drawing in
  1079. #                the document window.
  1080. # Parameters:    pBackgroundColor    - 0 - nothing done return 0
  1081. #                                    - Valid Item Num
  1082. #                                    - valid element struct
  1083. #                                    - 'Random' - generates a random element struct
  1084. #                pSelectItem - Boolean flag which indicates whether or not to 
  1085. #                            select the element.
  1086. #                pObjectNumber - Integer used to track all elements that make up 
  1087. #                                an object - TCS related.
  1088. # Returns:        BackgroundColorStruct - A valid BackgroundColorStruct
  1089. # Examples:        SetPhotoshopBackgroundColor('Random', 1, 14);
  1090. # Assumptions:    All draw related data structures set up properly.
  1091. #========================================================================
  1092. # History:
  1093. #    03/08/96    MDF        Created.
  1094. #########################################################################
  1095. task SetPhotoshopBackgroundColor(pBackgroundColor := 'Random', pSelectItem := 1,
  1096.                                  pObjectNumber := 0)
  1097. begin
  1098.     global gScriptResourceBase, gPaletteList, kPalWind;
  1099.     
  1100.     if( _matchBoolean([menuitem t:"Show Picker"]) )
  1101.         SelectMenuItem("Show Picker","Palettes","Window");
  1102.     
  1103.     if( _matchBoolean([window t:"Picker"]) )
  1104.         colPalTitle := "Picker";
  1105.     if( _matchBoolean([window t:"Scratch"]) )
  1106.         colPalTitle := "Scratch";
  1107.         
  1108.     colPalList := 
  1109.         {
  1110.             {                    #### Start Palette #4 - Color (both foreground and background)
  1111.             {colPalTitle,90,2},    # Specifier, Top margin, left margin
  1112.             kPalWind,            # Palette type
  1113.             {200,18},            # Size {numElemsWide,numElemsTall}
  1114.             {1,1}                # Offset between tools {h,v}
  1115.             }                    #### End Palette #4 - Color (both foreground and background)
  1116.         };
  1117.         
  1118.     gPaletteList := gPaletteList + colPalList;
  1119.  
  1120.     logStr("Clicking on the background color swatch in the color palette...");
  1121.     MoveRelativeToWindow(190,52,[window t:colPalTitle],2);
  1122.     if( await_presence([window t:'Color Picker' o:1],60) )
  1123.     begin
  1124.         logStr("'Color Picker' dialog appeared, dimissing dialog by hitting cancel button");
  1125.         DialogDismisser( 1,[window t:'Color Picker' o:1]);
  1126.     end;
  1127.     
  1128.     backgroundColorStruct := SetPaletteItem(pBackgroundColor, pSelectItem,
  1129.                                             "Background Color",
  1130.                                               global kBackgroundColorPaletteNum,
  1131.                                             pObjectNumber);    
  1132.     
  1133.     if( _matchBoolean([menuitem t:"Hide Picker"]) )
  1134.         SelectMenuItem("Hide Picker","Palettes","Window");
  1135.         
  1136.     return(backgroundColorStruct);
  1137.  
  1138. end; # SetPhotoshopBackgroundColor
  1139.  
  1140.  
  1141. #########################################################################
  1142. #                            ModifyForRevertHook()
  1143. #========================================================================
  1144. # Author:        MDF
  1145. # Description:    Modifies the photoshop document so that Revert can be done.
  1146. #                Calls Scrapbook to paste a PICT into the document.
  1147. # Parameters:    None
  1148. # Returns:        Nothing
  1149. # Examples:        ModifyForRevertHook();
  1150. # Assumptions:    None 
  1151. #========================================================================
  1152. # History:
  1153. #    MDF 08/24/95    Created
  1154. #########################################################################
  1155. task ModifyForRevertHook()
  1156. begin
  1157.     return( Scrapbook(global kScrapPict) );
  1158. end; # ModifyForRevertHook
  1159.  
  1160.  
  1161. #########################################################################
  1162. #                            PrintForCloseHook()
  1163. #========================================================================
  1164. # Author:        Geraldine O'Sullivan
  1165. # Description:    Waits for printing process dialog to clear.
  1166. # Parameters:    None
  1167. # Returns:        Nothing
  1168. # Examples:        PrintForCloseHook()
  1169. # Assumptions:    none
  1170. #========================================================================
  1171. # History:
  1172. #
  1173. #########################################################################
  1174. task PrintForCloseHook()
  1175. begin
  1176.     if(global gPrintTest)
  1177.     begin
  1178.         TCSStart({ 1, global kTCSetPrinting },"Select 'Print' Menuitem");
  1179.         SelectMenuItem(PrintMI[1], PrintMI[2]);        #To select Print
  1180.         if( await_presence([button t:'Proceed' w:1],30) )
  1181.         begin
  1182.             logStr("Clearing the alert dialog...");
  1183.             SpecialKey(ReturnKey,"Return Key - selects 'Proceed' button");
  1184.             await_absence([button t:'Proceed' w:1],30);
  1185.         end;
  1186.         wait(2);
  1187.         PrintDialogDesc:= _match([window o:1]!,1);
  1188.         if (global gPrinterHook)
  1189.             call (gPrinterHook);
  1190.         SpecialKey(returnKey, 'Return Key');    #To Select the Default-'OK'
  1191.         if not (FindWindow(PrintDialogDesc, true))
  1192.             TCSEnd({ 1, global kTCSetPrinting },1);
  1193.         else
  1194.             TCSEnd({ 1, global kTCSetPrinting },0);
  1195.         await_presence([window t:GetIndString(global gScriptResourceBase+4,1) o:1],60);    # window title is ' Printing'
  1196.         await_presence([window t:GetIndString(global gScriptResourceBase+4,1) o:1],60);    # window title is ' Printing'
  1197.     end;
  1198. end; # PrintForCloseHook
  1199.  
  1200.  
  1201. #########################################################################
  1202. #                    FilterTCS()
  1203. #========================================================================
  1204. # Author:        MF
  1205. # Description:    Applies all of the Filters in the 'Filter' menuitem.
  1206. # Parameters:    none
  1207. # Returns:        nada
  1208. # Examples:        FilterTCS();
  1209. # Assumptions:    none 
  1210. #========================================================================
  1211. # History:
  1212. # 03/01/96    MDF        Created.
  1213. #########################################################################
  1214. task FilterTCS()
  1215. begin
  1216.     println;
  1217.     println "------- Beginning Filter Tests --------";
  1218.  
  1219.     failStr := "";
  1220.     returnVal := 0;
  1221.     TCSReturn := 0;
  1222.  
  1223.     testCaseList :=    # menu item list
  1224.         {
  1225.             {"Blur","Blur","Filter"},
  1226.             {"Blur More","Blur","Filter"},
  1227.             {"Gaussian Blur…","Blur","Filter"},
  1228.             {"Motion Blur…","Blur","Filter"},
  1229.             {"Add Noise…","Noise","Filter"},
  1230.             {"Despeckle","Noise","Filter"},
  1231.             {"Dust & Scratches…","Noise","Filter"},
  1232.             {"Median…","Noise","Filter"},
  1233.             {"Facet","Pixelate","Filter"},
  1234.             {"Fragment","Pixelate","Filter"},
  1235.             {"Mosaic…","Pixelate","Filter"},
  1236.             {"Sharpen","Sharpen","Filter"},
  1237.             {"Sharpen Edges","Sharpen","Filter"},
  1238.             {"Sharpen More","Sharpen","Filter"},
  1239.             {"Unsharp Mask…","Sharpen","Filter"},
  1240.             {"Diffuse…","Stylize","Filter"},
  1241.             {"Emboss…","Stylize","Filter"},
  1242.             {"Find Edges","Stylize","Filter"},
  1243.             {"Trace Contour…","Stylize","Filter"},
  1244.             {"Custom…","Other","Filter"},
  1245.             {"High Pass…","Other","Filter"},
  1246.             {"Maximum…","Other","Filter"},
  1247.             {"Minimum…","Other","Filter"},
  1248.             {"Offset…","Other","Filter"}
  1249.         };
  1250.  
  1251.     for each filterTest in RandomList(testCaseList)
  1252.     begin
  1253.         TCSStart({1,"ApplyFilter"},"Apply '{filterTest[1]}' Filter");
  1254.         
  1255.         if( card(filterTest) < 3 )    # non-hierarchical menu
  1256.             returnVal := SelectMenuItem(filterTest[1],filterTest[2]);
  1257.         else    # hierarchical menu
  1258.             returnVal := SelectMenuItem(filterTest[1],filterTest[2],filterTest[3]);
  1259.             
  1260.         if(returnVal)    # selected menuitem successfully
  1261.         begin
  1262.             if( IsSubString("…",filterTest[1]) )    # expect a dialog
  1263.             begin
  1264.                 windTitle := StringUntilChar(filterTest[1],"…");
  1265.                 if( await_presence([window t:windTitle o:1],60) )
  1266.                 begin
  1267.                     SpecialKey(ReturnKey,"ReturnKey - 'OK' button");
  1268.                     if( await_absence([window t:windTitle o:1],60) )
  1269.                     begin
  1270.                         failStr := "";
  1271.                         TCSReturn := 1;
  1272.                     end;
  1273.                     else
  1274.                     begin
  1275.                         TCSReturn := 0;
  1276.                         failStr := "Could not apply filter by selecting the 'OK' button in the {windTitle} dialog";
  1277.                         DialogDismisser('All',[window t:windTitle]);
  1278.                     end;
  1279.                 end;
  1280.                 else
  1281.                 begin
  1282.                     TCSReturn := 0;
  1283.                     failStr := "Filter window for {windTitle} did not appear";
  1284.                 end;
  1285.             end;
  1286.             else
  1287.             begin
  1288.                 failStr := "";
  1289.                 TCSReturn := 1;
  1290.             end;
  1291.         end;
  1292.         else    # could not select menu item
  1293.         begin
  1294.             theMenuItem := _match([menuitem t:filterTest[1] m:filterTest[2]]);
  1295.             TCSReturn := 0;
  1296.             if(theMenuItem)
  1297.                 if(not theMenuItem.e)
  1298.                     failStr := "MenuItem is disabled so it couldn't be selected";
  1299.             else
  1300.                 failStr := "MenuItem is not present, so it couldn't be selected";
  1301.         end;
  1302.         
  1303.         TCSEnd({1,"ApplyFilter"},TCSReturn,failStr);
  1304.     end;    
  1305.     println "------- Completed Filter Tests --------";
  1306.     println;
  1307. end; # FilterTCS
  1308.  
  1309.  
  1310. #########################################################################
  1311. #                    SaveFormatTCS()
  1312. #========================================================================
  1313. # Author:        MF
  1314. # Description:    Saves the PhotoShop document in 9 different formats.
  1315. # Parameters:    none
  1316. # Returns:        nada
  1317. # Examples:        SaveFormatTCS();
  1318. # Assumptions:    none 
  1319. #========================================================================
  1320. # History:
  1321. # 03/04/96    MDF        Created.
  1322. #########################################################################
  1323. task SaveFormatTCS()
  1324. begin
  1325.     println;
  1326.     println "------- Beginning SaveFormat Tests --------";
  1327.  
  1328.     global gFileName;
  1329.     returnVal := 0;
  1330.  
  1331.     testCaseList :=     # popup names
  1332.         {
  1333.             "PhotoShop 2.0",
  1334.             "EPS",
  1335.             "JPEG",
  1336.             "PICT File",
  1337.             "PICT Resource",
  1338.             "RAW",
  1339.             "Scitex CT",
  1340.             "TIFF",
  1341.             "PhotoShop 3.0"
  1342.         };
  1343.     
  1344.     for each formatTest in testCaseList
  1345.     begin    
  1346.         TCSStart({ 1, global kTCSetSFSave },"SaveAs '{formatTest}' format");                        # Start TCS
  1347.         thisReturn := SelectMenuItem(7,2);     # 'Save As','File'
  1348.         TCSEnd({ 1, global kTCSetSFSave },thisReturn);        # Select the MenuItem
  1349.         
  1350.         isPresent := IsStandardFile();
  1351.         if not(isPresent)
  1352.         begin
  1353.             wait(8);
  1354.             isPresent := IsStandardFile();
  1355.         end;
  1356.  
  1357.         ## Continue only if Standard File is present
  1358.         if (isPresent) 
  1359.         begin
  1360.             SFPutDesc:= _match ([window o:1],1);    #    Save off the descriptor
  1361.             
  1362.             LogStr("############## Standard File - Save  ##############");
  1363.             
  1364.             if(formatTest = "PhotoShop 3.0")
  1365.                 TypeStr(gFileName);
  1366.             else
  1367.                 TypeStr("@!@-{formatTest}");        # Type the name of the Document
  1368.             
  1369.             SelectPopUpMenuItem(formatTest, "Format");
  1370.             SpecialKey(ReturnKey, 'Return Key');    # Accept the SF dialog
  1371.             
  1372.             if( await_presence([button t:'Replace' w:1],30) )
  1373.             begin
  1374.                 SelectButton('Replace');
  1375.                 returnval:= 2;
  1376.             end;
  1377.             
  1378.             if( await_presence([window o:1 s:movablemodal],60) )
  1379.             begin
  1380.                 logStr("Accepting default format options...");
  1381.                 SpecialKey(ReturnKey, 'Return Key');
  1382.                 await_absence([window o:1 s:movablemodal]);
  1383.             end;
  1384.             
  1385.             if not FindWindow(SFPutDesc, true)    # if we can't find SFPut Dialog, indicates saved document for 1st time
  1386.             begin    
  1387.                 if not (returnval)                # if not already reset from replace exist
  1388.                 begin
  1389.                     returnVal := 1;                # set to success - no replace exist done
  1390.                     TCSStart({ 2, global kTCSetSFSave },"Save a new file");
  1391.                     TCSEnd({ 2, global kTCSetSFSave },1,,,"@!@-{formatTest}");
  1392.                 end; # if not returnval
  1393.             end;
  1394.             else
  1395.                 logStr("Unable to dismiss the SFPut dialog");
  1396.         end;
  1397.     end;
  1398.     println "------- Completed SaveFormat Tests --------";
  1399.     println;
  1400. end; # SaveFormatTCS
  1401.  
  1402.  
  1403. #########################################################################
  1404. #                    MoveTCS()
  1405. #========================================================================
  1406. # Author:        MF
  1407. # Description:    Moves a region of a document that has been selected by the
  1408. #                Marquee or Lasso tools to a random location within the
  1409. #                document window.
  1410. # Parameters:    none
  1411. # Returns:        nada
  1412. # Examples:        MoveTCS();
  1413. # Assumptions:    none 
  1414. #========================================================================
  1415. # History:
  1416. # 03/04/96    MDF        Created.
  1417. #########################################################################
  1418. task MoveTCS()
  1419. begin
  1420.     println;
  1421.     println "------- Beginning Move Tests --------";
  1422.  
  1423.     failStr := "";
  1424.     returnVal := 0;
  1425.     TCSReturn := 0;
  1426.  
  1427.     objectStruct := Draw(global MarqueeTool,,,,,[window t:/≈RGB≈/]);
  1428.     pointList := objectStruct[2];
  1429.     objectRect := {
  1430.                     pointList[1][1],pointList[1][2],
  1431.                     pointList[2][1],pointList[2][2]
  1432.                    };
  1433.  
  1434.     TCSStart({1,"MoveObject"},"Move region cut-out");
  1435.  
  1436.     windDesc := FindWindow([window t:/≈RGB≈/]);
  1437.     if(windDesc)
  1438.     begin
  1439.         if (card(objectRect) = 4)    # if objectRect describes a rectangle
  1440.         begin
  1441.             objectCenter := CenterPointOfRect(objectRect);    # from SPEC: Geometry.Lib
  1442.             logStr("Moving cursor to center of object...");
  1443.             MoveRelativeToWindow(objectCenter[1],objectCenter[2],[window t:/≈RGB≈/]);     # move to center
  1444.         end;
  1445.         
  1446.         logStr("Moving the object to a random location...");
  1447.         MoveRelativeToWindow(,,[window t:/≈RGB≈/],1);     # move the object
  1448.         TCSReturn := 1;
  1449.     end;
  1450.     else
  1451.     begin
  1452.         failStr := "Could not find specified window";
  1453.         TCSReturn := 0;
  1454.     end;
  1455.     
  1456.     TCSEnd({1,"MoveObject"},TCSReturn,failStr);
  1457.     
  1458.     logStr("Clicking in corner of doc window to disable marquee");
  1459.     SetTool(global MarqueeTool);
  1460.     MoveRelativeToWindow(5,5,[window t:/≈RGB≈/],2);
  1461.  
  1462.     println "------- Completed Move Tests --------";
  1463.     println;
  1464.  
  1465. end; # MoveTCS
  1466.  
  1467.  
  1468. #########################################################################
  1469. #                                EffectsTCS()
  1470. #========================================================================
  1471. # Author:        MF
  1472. # Description:    Applies effects to a selected region of the document region.
  1473. # Returns:        nada
  1474. # Examples:        EffectsTCS();
  1475. # Assumptions:    none 
  1476. #========================================================================
  1477. # History:
  1478. # 03/04/96    MDF        Created.
  1479. #########################################################################
  1480. task EffectsTCS()
  1481. begin
  1482.     println;
  1483.     println "------- Beginning Effect Tests --------";
  1484.  
  1485.     failStr := "";
  1486.     returnVal := 0;
  1487.     TCSReturn := 0;
  1488.  
  1489.     testCaseList :=    # menu item list
  1490.         {
  1491.             {"Scale","Effects","Image"},
  1492.             {"Skew","Effects","Image"},
  1493.             {"Perspective","Effects","Image"},
  1494.             {"Distort","Effects","Image"}
  1495.         };
  1496.  
  1497.     for each effectTest in RandomList(testCaseList)
  1498.     begin
  1499.         objectStruct := Draw(global MarqueeTool,,,,,[window t:/≈RGB≈/]);
  1500.         pointList := objectStruct[2];
  1501.         objectRect := {
  1502.                         pointList[1][1],pointList[1][2],
  1503.                          pointList[2][1],pointList[2][2]
  1504.                        };
  1505.         
  1506.         TCSStart({1,"ApplyEffect"},"Apply '{effectTest[1]}' effect");
  1507.     
  1508.         returnVal := SelectMenuItem(effectTest[1],"Effects","Image");
  1509.     
  1510.         if(returnVal)    # selected menuitem successfully
  1511.         begin
  1512.             windDesc := FindWindow([window t:/≈RGB≈/]);
  1513.             if(windDesc)
  1514.             begin
  1515.                 MoveRelativeToWindow(objectRect[1],objectRect[2],[window t:/≈RGB≈/]);    # move to the object handle point
  1516.                 MoveRelativeToWindow(,,[window t:/≈RGB≈/],1);      # move the handle
  1517.                 SpecialKey(EnterKey,"Enter-Key disables object");
  1518.                 failStr := "";
  1519.                 TCSReturn := 1;      # success
  1520.             end;
  1521.             else
  1522.                 failStr := "Could not find specified window";
  1523.         end;
  1524.         else    # could not select menuitem
  1525.         begin
  1526.             theMenuItem := _match([menuitem t:effectTest[1] m:[menuitem t:"Effects" m:[menu t:"Image"]]]);
  1527.             TCSReturn := 0;
  1528.             if(theMenuItem)
  1529.                 if(not theMenuItem.e)
  1530.                     failStr := "MenuItem is disabled, so it couldn't be selected";
  1531.             else
  1532.                 failStr := "MenuItem is not present, so it couldn't be selected";
  1533.         end;
  1534.  
  1535.         TCSEnd({1,"ApplyEffect"},TCSReturn,failStr);
  1536.     end;
  1537.     println "------- Completed Effects Tests --------";
  1538.     println;
  1539.  
  1540. end; # EffectsTCS
  1541.  
  1542.  
  1543. #########################################################################
  1544. #                    RotateTCS()
  1545. #========================================================================
  1546. # Author:        MF
  1547. # Description:    Randomly rotates selected regions of the document.
  1548. # Parameters:    none
  1549. # Returns:        nada
  1550. # Examples:        RotateTCS();
  1551. # Assumptions:    none 
  1552. #========================================================================
  1553. # History:
  1554. # 03/05/96    MDF        Created.
  1555. #########################################################################
  1556. task RotateTCS()
  1557. begin
  1558.     println;
  1559.     println "------- Beginning Rotation Tests --------";
  1560.  
  1561.     failStr := "";
  1562.     returnVal := 0;
  1563.     TCSReturn := 0;
  1564.  
  1565.     testCaseList :=    # menu item list
  1566.         {
  1567.             {"180°","Rotate","Image"},
  1568.             {"90° CW","Rotate","Image"},
  1569.             {"90° CCW","Rotate","Image"},
  1570.             {"Arbitrary…","Rotate","Image"}
  1571.         };
  1572.         
  1573.     for each rotationTest in RandomList(testCaseList)
  1574.     begin
  1575.         TCSStart({1,"ApplyRotation"},"Apply '{rotationtest[1]}' rotation");
  1576.         
  1577.         returnVal := SelectMenuItem(rotationTest[1],"Rotate","Image");
  1578.         
  1579.         if(returnVal)    # selected menuitem sucessfully
  1580.         begin
  1581.             if( rotationTest[1] = "Arbitrary…" )
  1582.             begin
  1583.                 if( await_presence([window t:/Arbitrary≈/ o:1],60) )
  1584.                 begin
  1585.                     angle := random(0,359);        # generate a random angle
  1586.                     TypeStr(numToStr(angle,10));    # type angle into the dialog
  1587.                     SpecialKey(ReturnKey,"ReturnKey - to close the 'Arbitrary Rotate' dialog");    # close dialog
  1588.                     if( await_absence([window t:/Arbitrary≈/ o:1],60) )
  1589.                     begin
  1590.                         failStr := "";
  1591.                         TCSReturn := 1;
  1592.                     end;
  1593.                     else
  1594.                     begin
  1595.                         TCSReturn := 0;
  1596.                         failStr := "Could not do arbitrary rotation by selecting the 'OK' button";
  1597.                         DialogDismisser('All',[window t:/Arbitrary≈/ o:1]);
  1598.                     end;
  1599.                 end;
  1600.                 else
  1601.                 begin
  1602.                     TCSReturn := 0;
  1603.                     failStr := "The window 'Arbitary Rotate' did not appear";
  1604.                 end;
  1605.             end;
  1606.             else
  1607.             begin
  1608.                 failStr := "";
  1609.                 TCSReturn := 1;
  1610.             end;
  1611.         end;
  1612.         else
  1613.         begin
  1614.             theMenuItem := _match([menuitem t:rotationTest[1] m:[menuitem t:"Rotate" m:[menu t:"Image"]]]);
  1615.             TCSReturn := 0;
  1616.             if(theMenuItem)
  1617.                 if(not theMenuItem.e)
  1618.                     failStr := "MenuItem is disabled, so it couldn't be selected";
  1619.             else
  1620.                 failStr := "MenuItem is not present, so it couldn't be selected";
  1621.         end;
  1622.         TCSEnd({1,"ApplyRotation"},TCSReturn,failStr);
  1623.     end;
  1624.     println "------- Completed Rotation Tests --------";
  1625.     println;
  1626.  
  1627. end; # RotateTCS
  1628.  
  1629.  
  1630. #########################################################################
  1631. #                    FlipTCS()
  1632. #========================================================================
  1633. # Author:        MF
  1634. # Description:    Randomly flips selected regions of the document.
  1635. # Parameters:    none
  1636. # Returns:        nada
  1637. # Examples:        FlipTCS();
  1638. # Assumptions:    none 
  1639. #========================================================================
  1640. # History:
  1641. # 03/04/96    MDF        Created.
  1642. #########################################################################
  1643. task FlipTCS()
  1644. begin
  1645.     println;
  1646.     println "------- Beginning Flip Tests --------";
  1647.  
  1648.     failStr := "";
  1649.     returnVal := 0;
  1650.     TCSReturn := 0;
  1651.     
  1652.     testCaseList :=    # menu item list
  1653.         {
  1654.             {"Horizontal","Flip","Image"},
  1655.             {"Vertical","Flip","Image"}
  1656.         };
  1657.         
  1658.     for each flipTest in RandomList(testCaseList)
  1659.     begin
  1660.         TCSStart({1,"ApplyFlip"},"Apply '{flipTest[1]}' Flip");
  1661.         
  1662.         returnVal := SelectMenuItem(flipTest[1],"Flip","Image");
  1663.         
  1664.         if(returnVal)    # selected menuitem sucessfully
  1665.         begin
  1666.             failStr := "";
  1667.             TCSReturn := 1;
  1668.         end;
  1669.         else
  1670.         begin
  1671.             theMenuItem := _match([menuitem t:flipTest[1] m:[menuitem t:"Flip" m:[menu t:"Image"]]]);
  1672.             TCSREturn := 0;
  1673.             if(theMenuItem)
  1674.                 if(not theMenuItem.e)
  1675.                     failStr := "MenuItem is disabled, so it couldn't be selected";
  1676.             else
  1677.                 failStr := "MenuItem is not present, so it couldn't be selected";
  1678.         end;
  1679.         TCSEnd({1,"ApplyFlip"},TCSReturn,failStr);
  1680.     end;
  1681.     println "------- Completed Flip Tests --------";
  1682.     println;
  1683.     
  1684. end; # FlipTCS
  1685.  
  1686.  
  1687. #########################################################################
  1688. #                    ViewsTCS()
  1689. #========================================================================
  1690. # Author:        MF
  1691. # Description:    Changes the views of the document window by zooming in/out and
  1692. #                showing/hiding the rulers.
  1693. # Parameters:    none
  1694. # Returns:        nada
  1695. # Examples:        ViewsTCS();
  1696. # Assumptions:    none 
  1697. #========================================================================
  1698. # History:
  1699. # 03/04/96    MDF        Created.
  1700. #########################################################################
  1701. task ViewsTCS()
  1702. begin
  1703.     println;
  1704.     println "------- Beginning Views Tests --------";
  1705.  
  1706.     failStr := "";
  1707.     returnVal := 0;
  1708.     TCSReturn := 0;
  1709.     pCommentStr := "";
  1710.     
  1711.     testCaseList :=    # menu item list
  1712.         {
  1713.             {"Zoom In","Window"},
  1714.             {"Zoom Out","Window"},
  1715.             {"Zoom Factor…","Window"},
  1716.             {"Show Ruler","Window"},
  1717.             {"Hide Ruler","Window"}
  1718.         };
  1719.     
  1720.     await_presence([window t:/≈RGB≈/ o:2],60);    # waits for document window with this desc to appear
  1721.  
  1722.     for each viewTest in testCaseList    # don't do this randomly
  1723.     begin
  1724.         TCSStart({1,"ChangeViews"},"View: '{viewTest[1]}'");
  1725.         
  1726.         returnVal := SelectMenuItem(viewTest[1],"Window");
  1727.         
  1728.         if(returnVal)    # selected menuitem sucessfully
  1729.         begin
  1730.             if( viewTest[1] = "Zoom Factor…" )
  1731.             begin
  1732.                 if( await_presence([window t:/Zoom≈/ o:1],60) )
  1733.                 begin
  1734.                     zoomVal := random(1,10);    # generate random zoom factor
  1735.                     pCommentStr := "Magnify {zoomVal}x";
  1736.                     TypeStr(numToStr(zoomVal,10));     # type zoom factor into the dialog
  1737.                     SpecialKey(ReturnKey,"ReturnKey - to close the 'Zoom Factor' dialog");    # close dialog
  1738.                     if( await_absence([window t:/Zoom≈/ o:1],60) )
  1739.                     begin
  1740.                         failStr := "";
  1741.                         TCSReturn := 1;
  1742.                     end;
  1743.                     else
  1744.                     begin
  1745.                         TCSReturn := 0;
  1746.                         failStr := "Could not do arbitrary zoom by selecting the 'OK' button";
  1747.                         DialogDismisser('All',[window t:/Zoom≈/ o:1],60);
  1748.                     end;
  1749.                 end;
  1750.                 else
  1751.                 begin
  1752.                     TCSReturn := 0;
  1753.                     failStr := "The window 'Zoom Factor' did not appear";
  1754.                 end;
  1755.             end;
  1756.             else
  1757.             begin
  1758.                 failStr := "";
  1759.                 TCSReturn := 1;
  1760.             end;
  1761.         end;
  1762.         else
  1763.         begin
  1764.             theMenuItem := _match([menuitem t:viewTest[1] m:'Window']);
  1765.             TCSReturn := 0;
  1766.             if(theMenuItem)
  1767.                 if(not theMenuItem.e)
  1768.                     failStr := "MenuItem is disabled, so it couldn't be selected";
  1769.             else
  1770.                 failStr := "MenuItem is not present, so it couldn't be selected";
  1771.         end;
  1772.         TCSEnd({1,"ChangeViews"},TCSReturn,failStr,,,pCommentStr);
  1773.     end;
  1774.     println "------- Completed Views Tests --------";
  1775.     println;
  1776.  
  1777. end; # ViewsTCS
  1778.  
  1779.  
  1780. #########################################################################
  1781. #                    ColorPaletteTCS()
  1782. #========================================================================
  1783. # Author:        MF
  1784. # Description:    Rotates selected regions of the document.
  1785. # Parameters:    none
  1786. # Returns:        nada
  1787. # Examples:        ColorPaletteTCS();
  1788. # Assumptions:    none 
  1789. #========================================================================
  1790. # History:
  1791. # 03/07/96    MDF        Created.
  1792. #########################################################################
  1793. task ColorPaletteTCS()
  1794. begin
  1795.     println;
  1796.     println "------- Beginning Color Palette Tests --------";
  1797.  
  1798.     failStr := "";
  1799.     returnVal := 0;
  1800.     TCSReturn := 0;
  1801.  
  1802.     testCaseList :=    # menu item list
  1803.         {
  1804.             {"Grayscale","Mode"},
  1805.             {"CMYK Color","Mode"},
  1806.             {"Lab Color","Mode"},
  1807.             {"Multichannel","Mode"},
  1808.             {"RGB Color","Mode"}
  1809.         };
  1810.         
  1811.     for each colorMode in testCaseList
  1812.     begin
  1813.         TCSStart({1,"ColorMode"},"Change Color Mode to '{colorMode[1]}'");
  1814.         
  1815.         returnVal := SelectMenuItem(colorMode[1],"Mode");
  1816.         
  1817.         if(returnVal)    # selected menuitem sucessfully
  1818.         begin
  1819.             if( colorMode[1] = "Grayscale" )
  1820.             begin
  1821.                 if( await_presence([staticText t:'Discard color information?' w:1],60) )
  1822.                 begin
  1823.                     SpecialKey(ReturnKey,"ReturnKey - to close alert dialog box");
  1824.                     if( await_absence([staticText t:'Discard color information?' w:1],60) )
  1825.                     begin
  1826.                         failStr := "";
  1827.                         TCSReturn := 1;
  1828.                     end;
  1829.                     else
  1830.                     begin
  1831.                         TCSReturn := 0;
  1832.                         failStr := "Could dismiss 'Discard color information' alert by selecting the 'OK' button";
  1833.                         DialogDismisser('All',[staticText t:'Discard color information?' w:1]);
  1834.                     end;
  1835.                 end;
  1836.             end;
  1837.             else
  1838.             begin
  1839.                 failStr := "";
  1840.                 TCSReturn := 1;
  1841.             end;
  1842.         end;
  1843.         else
  1844.         begin
  1845.             theMenuItem := _match([menuitem t:colorMode[1] m:"Mode"]);
  1846.             TCSREturn := 0;
  1847.             if(theMenuItem)
  1848.                 if(not theMenuItem.e)
  1849.                     failStr := "MenuItem is disabled, so it couldn't be selected";
  1850.             else
  1851.                 failStr := "MenuItem is not present, so it couldn't be selected";
  1852.         end;
  1853.         TCSEnd({1,"ColorMode"},TCSReturn,failStr);
  1854.     end;
  1855.  
  1856.     println "------- Completed Color Palette Tests --------";
  1857.     println;
  1858.  
  1859. end; # ColorPaletteTCS
  1860.  
  1861.  
  1862. #########################################################################
  1863. #                    EditMenuTCS()
  1864. #========================================================================
  1865. # Author:        MF
  1866. # Description:    Selects menu items from the Edit menu in the order called.
  1867. # Parameters:    none
  1868. # Returns:        nada
  1869. # Examples:        EditMenuTCS();
  1870. # Assumptions:    none 
  1871. #========================================================================
  1872. # History:
  1873. # 03/07/96    MDF        Created.
  1874. #########################################################################
  1875. task EditMenuTCS()
  1876. begin
  1877.     CutTCS();
  1878.     PasteTCS();
  1879.     CopyTCS();
  1880.     PasteTCS();
  1881.     ClearTCS();
  1882.     CropTCS();
  1883.     UndoTCS();
  1884. end; # EditMenuTCS
  1885.  
  1886.  
  1887. #########################################################################
  1888. #                    UndoTCS()
  1889. #========================================================================
  1890. # Author:        MF
  1891. # Description:    Selects the 'Undo' menu item from the Edit menu if the menu
  1892. #                item is enabled.
  1893. # Parameters:    none
  1894. # Returns:        nada
  1895. # Examples:        UndoTCS();
  1896. # Assumptions:    none 
  1897. #========================================================================
  1898. # History:
  1899. # 03/07/96    MDF        Created.
  1900. #########################################################################
  1901. task UndoTCS()
  1902. begin
  1903.     println;
  1904.     println "------- Beginning Undo Tests --------";
  1905.  
  1906.     failStr := "";
  1907.     returnVal := 0;
  1908.     TCSReturn := 0;
  1909.     
  1910.     theMenuItem := _match([menuitem t:/Undo≈/ m:Edit]);
  1911.     if( theMenuItem.e )        # is it enabled to select?
  1912.     begin
  1913.         TCSStart({1,"EditMenuTest"},"Select 'Undo' menuitem");
  1914.         
  1915.         returnVal := SelectMenuItem(/Undo≈/,"Edit");
  1916.         if(returnVal)
  1917.             TCSReturn := 1;
  1918.         else
  1919.             failStr := "MenuItem 'Undo' is not present, so it couldn't be selected";
  1920.             
  1921.         TCSEnd({1,"EditMenuTest"},TCSReturn,failStr);
  1922.     end;
  1923.     else    # don't fail testcase if not enabled
  1924.         logStr("Not executing 'Undo' since this menu item not enabled");
  1925.  
  1926.     println "------- Completed Undo Tests --------";
  1927.     println;
  1928.  
  1929. end; # UndoTCS
  1930.  
  1931.  
  1932. #########################################################################
  1933. #                    CutTCS()
  1934. #========================================================================
  1935. # Author:        MF
  1936. # Description:    Selects the 'Cut' menu item from the Edit menu if the menu
  1937. #                item is enabled.
  1938. # Parameters:    none
  1939. # Returns:        nada
  1940. # Examples:        CutTCS();
  1941. # Assumptions:    none 
  1942. #========================================================================
  1943. # History:
  1944. # 03/07/96    MDF        Created.
  1945. #########################################################################
  1946. task CutTCS()
  1947. begin
  1948.     println;
  1949.     println "------- Beginning Cut Tests --------";
  1950.  
  1951.     failStr := "";
  1952.     returnVal := 0;
  1953.     TCSReturn := 0;
  1954.     
  1955.     Draw(global MarqueeTool,,,,,[window t:/≈RGB≈/]);
  1956.     
  1957.     theMenuItem := _match([menuitem t:"Cut" m:Edit]);
  1958.     if( theMenuItem.e )        # is it enabled to select?
  1959.     begin
  1960.         TCSStart({2,"EditMenuTest"},"Select 'Cut' menuitem");
  1961.         
  1962.         returnVal := SelectMenuItem("Cut","Edit");
  1963.         if(returnVal)
  1964.             TCSReturn := 1;
  1965.         else
  1966.             failStr := "MenuItem 'Cut' is not present, so it couldn't be selected";
  1967.             
  1968.         TCSEnd({2,"EditMenuTest"},TCSReturn,failStr);
  1969.     end;
  1970.     else    # don't fail testcase if not enabled
  1971.         logStr("Not executing 'Cut' since this menu item not enabled");
  1972.  
  1973.     println "------- Completed Cut Tests --------";
  1974.     println;
  1975.  
  1976. end; # CutTCS
  1977.  
  1978.  
  1979. #########################################################################
  1980. #                    CopyTCS()
  1981. #========================================================================
  1982. # Author:        MF
  1983. # Description:    Selects the 'Copy' menu item from the Edit menu if the menu
  1984. #                item is enabled.
  1985. # Parameters:    none
  1986. # Returns:        nada
  1987. # Examples:        CopyTCS();
  1988. # Assumptions:    none 
  1989. #========================================================================
  1990. # History:
  1991. # 03/07/96    MDF        Created.
  1992. #########################################################################
  1993. task CopyTCS()
  1994. begin
  1995.     println;
  1996.     println "------- Beginning Copy Tests --------";
  1997.  
  1998.     failStr := "";
  1999.     returnVal := 0;
  2000.     TCSReturn := 0;
  2001.     
  2002.     Draw(global MarqueeTool,,,,,[window t:/≈RGB≈/]);
  2003.     
  2004.     theMenuItem := _match([menuitem t:"Copy" m:Edit]);
  2005.     if( theMenuItem.e )        # is it enabled to select?
  2006.     begin
  2007.         TCSStart({3,"EditMenuTest"},"Select 'Copy' menuitem");
  2008.         
  2009.         returnVal := SelectMenuItem("Copy","Edit");
  2010.         if(returnVal)
  2011.             TCSReturn := 1;
  2012.         else
  2013.             failStr := "MenuItem 'Copy' is not present, so it couldn't be selected";
  2014.             
  2015.         TCSEnd({3,"EditMenuTest"},TCSReturn,failStr);
  2016.     end;
  2017.     else    # don't fail testcase if not enabled
  2018.         logStr("Not executing 'Copy' since this menu item not enabled");
  2019.  
  2020.     logStr("Clicking in corner of doc window to disable marquee");
  2021.     SetTool(global MarqueeTool);
  2022.     MoveRelativeToWindow(5,5,[window t:/≈RGB≈/],2);
  2023.  
  2024.     println "------- Completed Copy Tests --------";
  2025.     println;
  2026.  
  2027. end; # CopyTCS
  2028.  
  2029.  
  2030. #########################################################################
  2031. #                    PasteTCS()
  2032. #========================================================================
  2033. # Author:        MF
  2034. # Description:    Selects the 'Paste' menu item from the Edit menu if the menu
  2035. #                item is enabled.
  2036. # Parameters:    none
  2037. # Returns:        nada
  2038. # Examples:        PasteTCS();
  2039. # Assumptions:    none 
  2040. #========================================================================
  2041. # History:
  2042. # 03/07/96    MDF        Created.
  2043. #########################################################################
  2044. task PasteTCS()
  2045. begin
  2046.     println;
  2047.     println "------- Beginning Paste Tests --------";
  2048.  
  2049.     failStr := "";
  2050.     returnVal := 0;
  2051.     TCSReturn := 0;
  2052.     
  2053.     theMenuItem := _match([menuitem t:"Paste" m:Edit]);
  2054.     if( theMenuItem.e )        # is it enabled to select?
  2055.     begin
  2056.         TCSStart({4,"EditMenuTest"},"Select 'Paste' menuitem");
  2057.         
  2058.         returnVal := SelectMenuItem("Paste","Edit");
  2059.         if(returnVal)
  2060.             TCSReturn := 1;
  2061.         else
  2062.             failStr := "MenuItem 'Paste' is not present, so it couldn't be selected";
  2063.             
  2064.         TCSEnd({4,"EditMenuTest"},TCSReturn,failStr);
  2065.     end;
  2066.     else    # don't fail testcase if not enabled
  2067.         logStr("Not executing 'Paste' since this menu item not enabled");
  2068.  
  2069.     println "------- Completed Paste Tests --------";
  2070.     println;
  2071.  
  2072. end; # PasteTCS
  2073.  
  2074.  
  2075. #########################################################################
  2076. #                    ClearTCS()
  2077. #========================================================================
  2078. # Author:        MF
  2079. # Description:    Selects the 'Clear' menu item from the Edit menu if the menu
  2080. #                item is enabled.
  2081. # Parameters:    none
  2082. # Returns:        nada
  2083. # Examples:        ClearTCS();
  2084. # Assumptions:    none 
  2085. #========================================================================
  2086. # History:
  2087. # 03/07/96    MDF        Created.
  2088. #########################################################################
  2089. task ClearTCS()
  2090. begin
  2091.     println;
  2092.     println "------- Beginning Clear Tests --------";
  2093.  
  2094.     failStr := "";
  2095.     returnVal := 0;
  2096.     TCSReturn := 0;
  2097.     
  2098.     Draw(global MarqueeTool,,,,,[window t:/≈RGB≈/]);
  2099.     
  2100.     theMenuItem := _match([menuitem t:"Clear" m:Edit]);
  2101.     if( theMenuItem.e )        # is it enabled to select?
  2102.     begin
  2103.         TCSStart({5,"EditMenuTest"},"Select 'Clear' menuitem");
  2104.         
  2105.         returnVal := SelectMenuItem("Clear","Edit");
  2106.         if(returnVal)
  2107.             TCSReturn := 1;
  2108.         else
  2109.             failStr := "MenuItem 'Clear' is not present, so it couldn't be selected";
  2110.             
  2111.         TCSEnd({5,"EditMenuTest"},TCSReturn,failStr);
  2112.     end;
  2113.     else    # don't fail testcase if not enabled
  2114.         logStr("Not executing 'Clear' since this menu item not enabled");
  2115.  
  2116.     logStr("Clicking in corner of doc window to disable marquee");
  2117.     SetTool(global MarqueeTool);
  2118.     MoveRelativeToWindow(5,5,[window t:/≈RGB≈/],2);
  2119.  
  2120.     println "------- Completed Clear Tests --------";
  2121.     println;
  2122.  
  2123. end; # ClearTCS
  2124.  
  2125.  
  2126. #########################################################################
  2127. #                    CropTCS()
  2128. #========================================================================
  2129. # Author:        MF
  2130. # Description:    Selects the 'Crop' menu item from the Edit menu if the menu
  2131. #                item is enabled.
  2132. # Parameters:    none
  2133. # Returns:        nada
  2134. # Examples:        CropTCS();
  2135. # Assumptions:    none 
  2136. #========================================================================
  2137. # History:
  2138. # 03/07/96    MDF        Created.
  2139. #########################################################################
  2140. task CropTCS()
  2141. begin
  2142.     println;
  2143.     println "------- Beginning Crop Tests --------";
  2144.  
  2145.     failStr := "";
  2146.     returnVal := 0;
  2147.     TCSReturn := 0;
  2148.  
  2149.     Draw(global MarqueeTool,,,,,[window t:/≈RGB≈/]);
  2150.     
  2151.     theMenuItem := _match([menuitem t:"Crop" m:Edit]);
  2152.     if( theMenuItem.e )        # is it enabled to select?
  2153.     begin
  2154.         TCSStart({6,"EditMenuTest"},"Select 'Crop' menuitem");
  2155.         
  2156.         returnVal := SelectMenuItem("Crop","Edit");
  2157.         if(returnVal)
  2158.             TCSReturn := 1;
  2159.         else
  2160.             failStr := "MenuItem 'Crop' is not present, so it couldn't be selected";
  2161.             
  2162.         TCSEnd({6,"EditMenuTest"},TCSReturn,failStr);
  2163.     end;
  2164.     else    # don't fail testcase if not enabled
  2165.         logStr("Not executing 'Crop' since this menu item not enabled");
  2166.     
  2167.     println "------- Completed Crop Tests --------";
  2168.     println;
  2169.     
  2170. end; # CropTCS
  2171.  
  2172.  
  2173. #########################################################################
  2174. #                    PublishTCS()
  2175. #========================================================================
  2176. # Author:        MF
  2177. # Description:    Publishes the test document.
  2178. # Parameters:    none
  2179. # Returns:        nada
  2180. # Examples:        PublishTCS();
  2181. # Assumptions:    none 
  2182. #========================================================================
  2183. # History:
  2184. # 03/07/96    MDF        Created.
  2185. #########################################################################
  2186. task PublishTCS()
  2187. begin
  2188.     println;
  2189.     println "------- Beginning Publish Tests --------";
  2190.  
  2191.     failStr := "";
  2192.     returnVal := 0;
  2193.     TCSReturn := 0;
  2194.  
  2195.     TCSStart({1,"PublishDocument"},"Publish edition");
  2196.     
  2197.     returnVal := SelectMenuItem("Create Publisher…","Edit");
  2198.     
  2199.     if(returnVal)
  2200.     begin
  2201.         if(await_presence([staticText t:'Name of new edition:' w:1],60) )
  2202.         begin
  2203.             editionFileName := GetNewFileName("PhotoShop Edition",1);
  2204.             TypeStr(editionFileName);
  2205.             SelectButton("Publish");
  2206.             if( await_absence([staticText t:'Name of new edition:' w:1],60) )
  2207.                 TCSReturn := 1;
  2208.             else
  2209.             begin
  2210.                 TCSReturn := 0;
  2211.                 failStr := "Could not clear the Publish dialog";
  2212.                 DialogDismisser('All',[staticText t:'Name of new edition:' w:1]);
  2213.             end;
  2214.         end;
  2215.         else
  2216.         begin
  2217.             theMenuItem := _match([menuitem t:"Create Publisher…" m:"Edit"]);
  2218.             TCSReturn := 0;
  2219.             if(theMenuItem)
  2220.                 if(not theMenuItem.e)
  2221.                     failStr := "menuItem is disabled, so it couldn't be selected";
  2222.             else
  2223.                 failStr := "MenuItem is not present, so it couldn't be selected";
  2224.         end;
  2225.         TCSEnd({1,"PublishDocument"},TCSReturn,failStr);
  2226.     end;
  2227.     println "------- Completed Publish Tests --------";
  2228.     println;
  2229. end; # PublishTCS
  2230.  
  2231.  
  2232. #########################################################################
  2233. #                            ScreenModeTCS()
  2234. #========================================================================
  2235. # Author:        MF
  2236. # Description:    Functional Test:  Cycle through screen modes.
  2237. # Parameters:    None
  2238. # Returns:        Nothing
  2239. # Examples:        ScreenModeTCS()
  2240. # Assumptions:    none
  2241. #========================================================================
  2242. # History:
  2243. #    03/08/96    MDF        Created.
  2244. #########################################################################
  2245. task ScreenModeTCS()
  2246. begin
  2247.     println;
  2248.     println "------- Beginning Screen Mode Tests --------";
  2249.     Draw(global FullScrnNoMBarTool);
  2250.     Draw(global FullScrnMBarTool);
  2251.     Draw(global StndWindowsTool);
  2252.     println "------- Completed Screen Mode Tests --------";
  2253.     println;
  2254. end; # ScreenModeTCS
  2255.  
  2256.  
  2257. ################################################################################
  2258. ####################             Main script                    ####################
  2259. ################################################################################
  2260. script PhotoShop ( testLevel := 1,
  2261.                    _______________________ := "_________________________",
  2262.                    filterTests_flag := 0,
  2263.                    saveFormatTests_flag := 0,
  2264.                    moveTests_flag := 0,
  2265.                    effectsTests_flag := 0,
  2266.                    rotateTests_flag := 0,
  2267.                    flipTests_flag := 0,
  2268.                    viewsTests_flag := 0,
  2269.                    colorPaletteTests_flag := 0,
  2270.                    editMenuTests_flag := 0,
  2271.                    publishTests_flag := 0,
  2272.                    screenModeTests_flag := 0,
  2273.                    ______________________ := "_________________________",
  2274.                    globalDefinitions := {{'gPrintTest',0}},
  2275.                    pAppLanguage := '',
  2276.                    pScriptSystem := {} )
  2277. begin
  2278.     InitGlobals( testLevel, globalDefinitions );    # initialize general globals
  2279.     InitDraw();
  2280.     InitFonts();
  2281.     InitINTLGlobals( pAppLanguage, pScriptSystem, {'US'} );
  2282.     global gApptitle := GetIndString(global gScriptResourceBase,2);     # US Title is "Adobe Photoshop PPC"
  2283.     global gAppVersion := GetIndString(global gScriptResourceBase,3);    # US version is '3.0.1@'
  2284.     global glaunchreqs := {'PowerPCArch'};        # Run script only on PowerPC based machine
  2285.     SuiteStart('Adobe Photoshop PPC 3.0.1.vu');    # begin a new test suite    
  2286.     if LaunchTwitch("{gAppTitle}",gAliasDirectory) # launch or twitch to app
  2287.     begin
  2288.         InitAppGlobals();                        # init app specific globals
  2289.         global gFileName := "@!@-{gAppTitle}";    # This is used in SaveAs when saving files
  2290.         (*
  2291.         *)
  2292.         quicklookTaskList := { task DoDraw, task DoText, task DoWindow};
  2293.         
  2294.         functionalTaskList :=
  2295.             { 
  2296.                 {task FilterTCS,filterTests_flag},
  2297.                 {task SaveFormatTCS,saveFormatTests_flag},
  2298.                 {task MoveTCS,moveTests_flag},
  2299.                   {task EffectsTCS,effectsTests_flag},
  2300.                 {task RotateTCS,rotateTests_flag},
  2301.                 {task FlipTCS,flipTests_flag},
  2302.                 {task ViewsTCS,viewsTests_flag},
  2303.                   {task ColorPaletteTCS,colorPaletteTests_flag},
  2304.                 {task EditMenuTCS,editMenuTests_flag},
  2305.                   {task PublishTCS,publishTests_flag},
  2306.                 {task ScreenModeTCS,screenModeTests_flag}
  2307.             };
  2308.         
  2309.         DoSetUpApp(0,-1,{1,2},1,1,1,{7,2},{2,2});    # must start with this
  2310.         TestTaskDispatcher(quicklookTaskList,functionalTaskList);
  2311.         DoCloseApp({{9,2},{7,2}},0,{16,2},0,{21,2});    # must end with this
  2312.     end; # if LaunchTwitch("{gAppTitle}",gAliasDirectory)
  2313.     SuiteEnd();
  2314. end;    # script PhotoShop